From 362b904900c6dc21e06c91faa9dc458d6743eecb Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Sun, 11 Sep 2022 10:52:53 -0400 Subject: [PATCH] Rewrote test cases with new syntax --- parser/data_test.go | 16 ++++++++-------- parser/objt_test.go | 37 ++++++++++++++++++++----------------- tests/parser/data/main.arf | 17 +++++++++-------- tests/parser/objt/main.arf | 34 ++++++++++++++++++---------------- tests/parser/skim/main.arf | 18 +++++++++--------- 5 files changed, 64 insertions(+), 58 deletions(-) diff --git a/parser/data_test.go b/parser/data_test.go index f6b7df3..ab7b8f7 100644 --- a/parser/data_test.go +++ b/parser/data_test.go @@ -25,15 +25,15 @@ data ro gIntegerArrayInitialized:Int:16 4785 92 data ro jObject:thing.Thing.thing.thing - .that 2139 - .this 324 + -- that 2139 + -- this 324 data ro kNestedObject:Obj - .that - .bird2 123.8439 - .bird3 9328.21348239 - .this - .bird0 324 - .bird1 "hello world" + -- that + -- bird2 123.8439 + -- bird3 9328.21348239 + -- this + -- bird0 324 + -- bird1 "hello world" data ro lMutIntegerArray16:Int:16:mut data ro mExternalData:Int:8 external diff --git a/parser/objt_test.go b/parser/objt_test.go index eda582d..aa3651b 100644 --- a/parser/objt_test.go +++ b/parser/objt_test.go @@ -2,30 +2,33 @@ package parser import "testing" +// TODO: merge this test with the type test func TestObjt (test *testing.T) { checkTree ("../tests/parser/objt", false, `:arf --- -objt ro Basic:Obj - ro that:Basic - ro this:Basic -objt ro BitFields:Obj +type ro aBasic:Obj + ro that:Int + ro this:Int +type ro bBitFields:Obj ro that:Int & 1 ro this:Int & 24 298 -objt ro ComplexInit:Obj - ro whatever:Int:3 - 230984 - 849 - 394580 - ro complex0:Bird - .that 98 - .this 2 - ro complex1:Bird - .that 98902 - .this 235 - ro basic:Int 87 -objt ro Init:Obj +type ro cInit:Obj ro that:String "hello world" ro this:Int 23 +type ro dInitInherit:aBasic + -- that 9384 + -- this 389 +type ro cInitAndDefine:aBasic + -- this 389 + ro these:aBasic + ro born:Int 4 + ro in:Int + ro the:Int:3 + 9348 + 92384 + 92834 + -- this 98 + -- that 9384 `, test) } diff --git a/tests/parser/data/main.arf b/tests/parser/data/main.arf index 55833af..81fb5d2 100644 --- a/tests/parser/data/main.arf +++ b/tests/parser/data/main.arf @@ -25,16 +25,17 @@ data ro gIntegerArrayInitialized:Int:16 # TODO: maybe test identifiers somewhere else? data ro jObject:thing.Thing. thing.thing - .this 324 - .that 2139 + -- this 324 + -- that 2139 data ro kNestedObject:Obj - .this - .bird0 324 - .bird1 "hello world" - .that - .bird2 123.8439 - .bird3 9328.21348239 + -- this + -- bird0 324 + -- bird1 "hello world" + ro newMember:Int 9023 + -- that + -- bird2 123.8439 + -- bird3 9328.21348239 data ro lMutIntegerArray16:Int:16:mut diff --git a/tests/parser/objt/main.arf b/tests/parser/objt/main.arf index 9026d29..795bba3 100644 --- a/tests/parser/objt/main.arf +++ b/tests/parser/objt/main.arf @@ -1,25 +1,27 @@ :arf --- -objt ro Basic:Obj - ro that:Basic - ro this:Basic +type ro aBasic:Obj + ro that:Int + ro this:Int -objt ro BitFields:Obj +type ro bBitFields:Obj ro that:Int & 1 ro this:Int & 24 298 -objt ro Init:Obj +type ro cInit:Obj ro that:String "hello world" ro this:Int 23 -objt ro ComplexInit:Obj - ro whatever:Int:3 - 230984 - 849 394580 - ro complex0:Bird - .that 98 - .this 2 - ro complex1:Bird - .that 98902 - .this 235 - ro basic:Int 87 +type ro dInitInherit:aBasic + -- that 9384 + -- this 389 + +type ro cInitAndDefine:aBasic + -- this 389 + ro these:aBasic + ro born:Int 4 + ro in:Int + ro the:Int:3 + 9348 92384 92834 + -- this 98 + -- that 9384 diff --git a/tests/parser/skim/main.arf b/tests/parser/skim/main.arf index eefef04..762a451 100644 --- a/tests/parser/skim/main.arf +++ b/tests/parser/skim/main.arf @@ -7,12 +7,12 @@ data ro aExternalData:Int data ro bSingleValue:Int 342 data ro cNestedObject:Obj - .this - .bird0 324 - .bird1 "hello world" - .that - .bird2 123.8439 - .bird3 9328.21348239 + -- this + -- bird0 324 + -- bird1 "hello world" + -- that + -- bird2 123.8439 + -- bird3 9328.21348239 data ro dUninitialized:Int:16:mut @@ -28,9 +28,9 @@ func ro fComplexFunction 398 9 2309 983 -2387 478 555 123 = bird:Bird - .that - .whenYou 99999 - .this 324 + -- that + -- whenYou 99999 + -- this 324 func ro gExternalFunction > x:Int