aboutsummaryrefslogtreecommitdiff
path: root/test/type_of.ml
diff options
context:
space:
mode:
authorChimrod <>2024-06-15 12:31:47 +0200
committerChimrod <>2024-06-15 12:38:52 +0200
commit4f39ffe31805039df54124ce15562c34e12ac7e6 (patch)
tree12cdd818a8c8706d7e71e8a565a7b5d528864baa /test/type_of.ml
parente6053d23747c09acfb3169e923dbac0e5a02b495 (diff)
Better type handling
Diffstat (limited to 'test/type_of.ml')
-rw-r--r--test/type_of.ml25
1 files changed, 13 insertions, 12 deletions
diff --git a/test/type_of.ml b/test/type_of.ml
index e5f7f9b..53d01bd 100644
--- a/test/type_of.ml
+++ b/test/type_of.ml
@@ -22,25 +22,26 @@ let message' level =
};
]
+let integer_as_string =
+ [
+ Qsp_syntax.Report.
+ {
+ level = Warn;
+ loc = _position;
+ message = "The type Integer is expected but got Integer as String";
+ };
+ ]
+
let _test_instruction : string -> Qsp_syntax.Report.t list -> unit =
Check._test_instruction
let type_mismatch () = _test_instruction {|abc = 'ABC'|} (message Error)
let assign_int_str () = _test_instruction {|$abc = 123|} (message Warn)
let type_mismatch2 () = _test_instruction {|abc[''] = $Var|} (message Warn)
+let type_conversion () = _test_instruction {|abc = '123'|} integer_as_string
-let type_conversion () =
- _test_instruction {|abc = '123'|}
- [
- {
- level = Warn;
- loc = _position;
- message = "The type Integer is expected but got Integer as String";
- };
- ]
-
-(** This expression is not considered as a string *)
-let type_conversion' () = _test_instruction {|abc = '<<123>>'|} []
+let type_conversion' () =
+ _test_instruction {|abc = '<<123>>'|} integer_as_string
let type_comparaison () = _test_instruction {|(abc = '123')|} []
let type_comparaison_eq () = _test_instruction {|($abc = 123)|} (message Warn)