diff options
Diffstat (limited to 'test/syntax_error.ml')
-rw-r--r-- | test/syntax_error.ml | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/test/syntax_error.ml b/test/syntax_error.ml index 6c28f0f..08de384 100644 --- a/test/syntax_error.ml +++ b/test/syntax_error.ml @@ -116,7 +116,46 @@ let inline_elif () = { level = Error; loc = _position; - message = "Mix between IF block and inline ELIF"; + message = "Mix between `IF` block and inline `ELIF`"; + } + +let unclosed_block () = + _test_instruction {| +if $ARGS[0] = 'arg': + act'action': +end|} + { + level = Error; + loc = _position; + message = + "Unclosed `IF` block. Another block ends before the `END` instruction."; + }; + + _test_instruction + {| +IF 1: +ELSE + 0 + |} + { + level = Error; + loc = _position; + message = + "Unclosed `ELSE` block. Another block ends before the `END` \ + instruction."; + }; + _test_instruction + {| +IF 1: +ELSEIF 0: + 0 + |} + { + level = Error; + loc = _position; + message = + "Unclosed `ELIF` block. Another block ends before the `END` \ + instruction."; } let test = @@ -132,4 +171,5 @@ let test = Alcotest.test_case "Missing operand" `Quick missing_operand; Alcotest.test_case "Unknown function" `Quick unknow_function; Alcotest.test_case "Inline elif" `Quick inline_elif; + Alcotest.test_case "Unclosed block" `Quick unclosed_block; ] ) |