diff options
| -rw-r--r-- | testes/errors.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/testes/errors.lua b/testes/errors.lua index 422c1128..a3f07021 100644 --- a/testes/errors.lua +++ b/testes/errors.lua | |||
| @@ -67,6 +67,27 @@ checksyntax([[ | |||
| 67 | ]], "'}' expected (to close '{' at line 1)", "<eof>", 3) | 67 | ]], "'}' expected (to close '{' at line 1)", "<eof>", 3) |
| 68 | 68 | ||
| 69 | 69 | ||
| 70 | do -- testing errors in goto/break | ||
| 71 | local function checksyntax (prog, msg, line) | ||
| 72 | local st, err = load(prog) | ||
| 73 | assert(string.find(err, "line " .. line)) | ||
| 74 | assert(string.find(err, msg, 1, true)) | ||
| 75 | end | ||
| 76 | |||
| 77 | checksyntax([[ | ||
| 78 | ::A:: a = 1 | ||
| 79 | ::A:: | ||
| 80 | ]], "label 'A' already defined", 1) | ||
| 81 | |||
| 82 | checksyntax([[ | ||
| 83 | a = 1 | ||
| 84 | goto A | ||
| 85 | do ::A:: end | ||
| 86 | ]], "no visible label 'A'", 2) | ||
| 87 | |||
| 88 | end | ||
| 89 | |||
| 90 | |||
| 70 | if not T then | 91 | if not T then |
| 71 | (Message or print) | 92 | (Message or print) |
| 72 | ('\n >>> testC not active: skipping memory message test <<<\n') | 93 | ('\n >>> testC not active: skipping memory message test <<<\n') |
