From a1bb96e73f54eaa7c7e4af5d930e9d10074afb08 Mon Sep 17 00:00:00 2001
From: Chimrod <>
Date: Sun, 29 Oct 2023 11:05:47 +0100
Subject: Added tests for the nested literal mecanism
---
test/syntax.ml | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
(limited to 'test/syntax.ml')
diff --git a/test/syntax.ml b/test/syntax.ml
index 432ca8d..aabe2a8 100644
--- a/test/syntax.ml
+++ b/test/syntax.ml
@@ -790,6 +790,7 @@ let test_mutiple_inline_ifs () =
};
]
+(** The boolean comparaison has greater precedence than arithmetic operator *)
let test_precedence7 () =
_test_instruction "(1 + 1 = '')"
[
@@ -805,6 +806,7 @@ let test_precedence7 () =
Tree.Ast.Literal (_position, [ T.Text "" ]) ));
]
+(** The OR operator has greater precedence than boolean comparaison *)
let test_precedence8 () =
_test_instruction "(0 = 1 or 0 = 1)"
[
@@ -824,19 +826,6 @@ let test_precedence8 () =
Tree.Ast.Integer (_position, "1") ) ));
]
-let nested_string () =
- _test_instruction
- {|'Delete'|}
- [
- Tree.Ast.Expression
- (Tree.Ast.Literal
- ( _position,
- [
- T.Text
- {|Delete|};
- ] ));
- ]
-
(** Test showing the - should be considered as an operator and cannot be
aggregated inside the integer value. *)
let minus_operator () =
@@ -861,6 +850,7 @@ let test =
test_negative_numeric_expression;
Alcotest.test_case "-Numeric expression2" `Quick
test_negative_numeric_expression2;
+ Alcotest.test_case "Minus op" `Quick minus_operator;
Alcotest.test_case "$Variable expression" `Quick test_str_variable;
Alcotest.test_case " Variable expression" `Quick test_variable;
Alcotest.test_case "Indexed Variable expression" `Quick
@@ -915,6 +905,4 @@ let test =
Alcotest.test_case "inline if else if" `Quick test_mutiple_inline_ifs;
Alcotest.test_case "Precedence7" `Quick test_precedence7;
Alcotest.test_case "Precedence8" `Quick test_precedence8;
- Alcotest.test_case "Nested string" `Quick nested_string;
- Alcotest.test_case "Nested string" `Quick minus_operator;
] )
--
cgit v1.2.3