Skip to content

Commit d81d160

Browse files
committed
Add tests for multiple error conditions.
The idea is having test coverage for all normal error conditions in the parser.
1 parent 3e78575 commit d81d160

24 files changed

Lines changed: 99 additions & 1 deletion

testsuite/tests/err-loop-1.bas

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
LOOP
3+

testsuite/tests/err-loop-1.chk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Name: Check detection of loop errors
2+
Test: compile-error
3+
Error: bad loop at line 2 column 0
4+
Error-pos: 2:4

testsuite/tests/err-loop-2.bas

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
' Open WHILE/WEND loop and close with DO/LOOP.
2+
WHILE 1
3+
LOOP
4+

testsuite/tests/err-loop-2.chk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Name: Check detection of loop errors
2+
Test: compile-error
3+
Error: bad loop at line 3 column 0
4+
Error-pos: 3:4

testsuite/tests/err-loop-3.bas

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
' Try to exit with no loop:
2+
EXIT
3+

testsuite/tests/err-loop-3.chk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Name: Check detection of loop errors
2+
Test: compile-error
3+
Error: bad loop at line 2 column 1
4+
Error-pos: 2:4

testsuite/tests/err-loop-4.bas

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
' EXIR from DATA
2+
DATA A() = 1,2,
3+
EXIT
4+
DATA 3,4
5+
6+

testsuite/tests/err-loop-4.chk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Name: Check detection of loop errors
2+
Test: compile-error
3+
Error: bad loop at line 3 column 1
4+
Error-pos: 4:5

testsuite/tests/err-loop-5.bas

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
' Open too many loop:
2+
DO:DO:DO:DO:DO:DO:DO:DO:DO:DO:DO:DO:DO:DO:DO:DO
3+
DO:DO:DO:DO:DO:DO:DO:DO:DO:DO:DO:DO:DO:DO:DO:DO
4+
DO:DO:DO:DO:DO:DO:DO:DO:DO:DO:DO:DO:DO:DO:DO:DO
5+

testsuite/tests/err-loop-5.chk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Name: Check detection of loop errors
2+
Test: compile-error
3+
Error: bad loop at line 4 column 31
4+
Error-pos: 6:0

0 commit comments

Comments
 (0)