From c625ed1cfe7f7ea4ab2a75a8a0a6a6772f86431c Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Fri, 30 Apr 2021 14:06:58 -0400 Subject: Destroy my own code by using goto --- tests/block-test.tnsl | 13 ++++++++++--- tests/parameter-test.tnsl | 2 +- tests/run-tests.sh | 18 ++++++------------ tests/statement-test.tnsl | 6 ++++++ 4 files changed, 23 insertions(+), 16 deletions(-) create mode 100644 tests/statement-test.tnsl (limited to 'tests') diff --git a/tests/block-test.tnsl b/tests/block-test.tnsl index 9f25526..6dde05f 100644 --- a/tests/block-test.tnsl +++ b/tests/block-test.tnsl @@ -46,15 +46,22 @@ /; module vec - ;struct Vector2 {x, y int} + ;struct Vector2 {int32 x, y} - /;method ~Vector2 + /;method Vector2 - /; operator + (v ~Vector2) + /; operator + (~Vector2 v) ;self.x += `v.x ;self.y += `v.y ;/ + /; operator + (int32 a) + ;self.x += a + ;self.y += a + ;/ + ;/ + ;struct FVector2 () {} + ;/ \ No newline at end of file diff --git a/tests/parameter-test.tnsl b/tests/parameter-test.tnsl index 2c39cb9..254db75 100644 --- a/tests/parameter-test.tnsl +++ b/tests/parameter-test.tnsl @@ -14,5 +14,5 @@ limitations under the License. #/ -/; loop (int initial = 0, int complex = 2) [initial < max || complex < 40, initial++, complex += 7, another += 2] +/; loop (int initial = 0, complex = 2) [initial < max || complex < 40, initial++, complex += 7, another += 2] ;/ diff --git a/tests/run-tests.sh b/tests/run-tests.sh index 2443823..6cebbe7 100755 --- a/tests/run-tests.sh +++ b/tests/run-tests.sh @@ -2,17 +2,11 @@ PARSECMD=../build/parse PARSEFILE=" " parse () { - $PARSECMD -in $PARSEFILE-test.tnsl -out $PARSEFILE-test.tnt + $PARSECMD -in $1-test.tnsl -out $1-test.tnt } -PARSEFILE=block -parse - -PARSEFILE=comment -parse - -PARSEFILE=literal -parse - -PARSEFILE=parameter -parse \ No newline at end of file +parse block +parse comment +parse literal +parse parameter +parse statement \ No newline at end of file diff --git a/tests/statement-test.tnsl b/tests/statement-test.tnsl new file mode 100644 index 0000000..71bd64b --- /dev/null +++ b/tests/statement-test.tnsl @@ -0,0 +1,6 @@ +/; small_block +;/ + +/; if_block +;; else_block +;/ \ No newline at end of file -- cgit v1.2.3