aboutsummaryrefslogtreecommitdiff
path: root/test/syntax.ml
diff options
context:
space:
mode:
authorChimrod <>2024-09-13 09:25:38 +0200
committerChimrod <>2024-09-13 09:25:38 +0200
commit8b4eb01afa698dd1e512f7a83fb761bfb146fdf7 (patch)
tree5c85e5f4d011a895955d8516f0cdb195acf82f24 /test/syntax.ml
parent692d66ba7eb0ff55a46b68601b7cd81f825653cb (diff)
Added a syntax check in the comments
Diffstat (limited to 'test/syntax.ml')
-rw-r--r--test/syntax.ml34
1 files changed, 26 insertions, 8 deletions
diff --git a/test/syntax.ml b/test/syntax.ml
index f15c72f..f922e4f 100644
--- a/test/syntax.ml
+++ b/test/syntax.ml
@@ -400,6 +400,18 @@ life is unfair." Oh yeah, {curly brackets
also count}. This is still the same comment. |}
[ Comment _position ]
+let test_comment_string () =
+ _test_instruction {|! {}|} [ Comment _position ];
+ _test_instruction {|! ''|} [ Comment _position ];
+ _test_instruction {|! ""|} [ Comment _position ];
+ _test_instruction {|! {''}|} [ Comment _position ];
+ _test_instruction {|! {""}|} [ Comment _position ];
+ _test_instruction {|! "{"|} [ Comment _position ];
+ _test_instruction {|! '{'|} [ Comment _position ];
+ _test_instruction {|! "'"|} [ Comment _position ];
+ _test_instruction {|! '"'|} [ Comment _position ];
+ ()
+
(** This test ensure that the unary operator is applied to the whole expression
*)
let test_precedence () =
@@ -882,7 +894,7 @@ let test_stattxt () =
{ Tree.Ast.pos = _position; name = "$STATTXT"; index = None } );
]
-let test =
+let test_syntax =
( "Syntax",
[
Alcotest.test_case "Location" `Quick test_empty_location;
@@ -915,13 +927,6 @@ let test =
Alcotest.test_case "Plus_litt" `Quick test_plus_litt;
Alcotest.test_case "PlusChained" `Quick test_concat;
Alcotest.test_case "Mod operator" `Quick test_mod;
- Alcotest.test_case "Comment" `Quick test_comment;
- Alcotest.test_case "Comment2" `Quick test_comment2;
- Alcotest.test_case "Comment3" `Quick test_comment3;
- Alcotest.test_case "Comment4" `Quick test_comment4;
- Alcotest.test_case "Comment5" `Quick test_comment5;
- Alcotest.test_case "Comment6" `Quick test_comment6;
- Alcotest.test_case "Multiline Comment" `Quick test_long_comment;
Alcotest.test_case "If" `Quick test_if;
Alcotest.test_case "If_chained" `Quick test_if_chained;
Alcotest.test_case "If_equality" `Quick test_if_equality;
@@ -952,3 +957,16 @@ let test =
Alcotest.test_case "Precedence8" `Quick test_precedence8;
Alcotest.test_case "stattxt" `Quick test_stattxt;
] )
+
+let test_comments =
+ ( "Comments",
+ [
+ Alcotest.test_case "Simple Comment" `Quick test_comment;
+ Alcotest.test_case "& Comment" `Quick test_comment2;
+ Alcotest.test_case "Double Comment" `Quick test_comment3;
+ Alcotest.test_case "Comment vs operation" `Quick test_comment4;
+ Alcotest.test_case "Comment5" `Quick test_comment5;
+ Alcotest.test_case "Comment6" `Quick test_comment6;
+ Alcotest.test_case "Multiline Comment" `Quick test_long_comment;
+ Alcotest.test_case "Comments with strings" `Quick test_comment_string;
+ ] )