aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChimrod <>2023-10-19 09:51:16 +0200
committerChimrod <>2023-10-21 18:56:20 +0200
commit73e7e0ca6b7b7a0676300d7900c743defe41fa10 (patch)
tree65ac73c1121f18a087b13479deaa1f490edd4889 /test
parent8101e3d39333bb80757228b604e1e825a062b1e0 (diff)
Updated the tests
Diffstat (limited to 'test')
-rw-r--r--test/syntax_error.ml42
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;
] )