aboutsummaryrefslogtreecommitdiff
path: root/test/syntax_error.ml
diff options
context:
space:
mode:
authorChimrod <>2024-01-20 21:59:10 +0100
committerChimrod <>2024-01-20 21:59:10 +0100
commit8a02bbbd2bf42e2152faca16b95152744ef416d0 (patch)
tree0eb17c69ba9db26a1b45357d3f3a5bd5cb443da1 /test/syntax_error.ml
parent2abe1fae40a1c65ff66ad51c98d92be9c7d9d8a5 (diff)
Reject a syntax which was incorrectly accepted
Diffstat (limited to 'test/syntax_error.ml')
-rw-r--r--test/syntax_error.ml21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/syntax_error.ml b/test/syntax_error.ml
index 04b91ad..490ec96 100644
--- a/test/syntax_error.ml
+++ b/test/syntax_error.ml
@@ -206,6 +206,26 @@ let location_change () =
check' ~msg:"The location name is not valid" string ~actual
~expected:"Location"))
+let misplaced_if () =
+ _test_instruction {|
+if $ARGS[0] = 'arg':
+ 0
+end if|}
+ {
+ level = Error;
+ loc = _position;
+ message = "Unexpected instruction after `IF` `END` block.";
+ };
+ _test_instruction {|
+act 'arg':
+ 0
+end if|}
+ {
+ level = Error;
+ loc = _position;
+ message = "Unexpected instruction after `ACT` `END` block.";
+ }
+
(* The location name *)
let test =
@@ -225,4 +245,5 @@ let test =
Alcotest.test_case "Unclosed block" `Quick comment_as_operator;
Alcotest.test_case "Missing comparable" `Quick missing_comparable;
Alcotest.test_case "Location change" `Quick location_change;
+ Alcotest.test_case "Misplaced if" `Quick misplaced_if;
] )