diff options
author | Chimrod <> | 2024-06-15 12:31:47 +0200 |
---|---|---|
committer | Chimrod <> | 2024-06-15 12:38:52 +0200 |
commit | 4f39ffe31805039df54124ce15562c34e12ac7e6 (patch) | |
tree | 12cdd818a8c8706d7e71e8a565a7b5d528864baa /test/get_type.ml | |
parent | e6053d23747c09acfb3169e923dbac0e5a02b495 (diff) |
Better type handling
Diffstat (limited to 'test/get_type.ml')
-rw-r--r-- | test/get_type.ml | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/get_type.ml b/test/get_type.ml index d7bb333..627e2a8 100644 --- a/test/get_type.ml +++ b/test/get_type.ml @@ -36,10 +36,44 @@ let concat_text () = let msg = "Concatenate" in Alcotest.(check' type_of ~msg ~expected ~actual) +let literal_1 () = + let actual = + Get_type.literal _position [ T.Expression (Get_type.Raw Integer) ] + and expected = Get_type.(Raw NumericString) in + let msg = "" in + Alcotest.(check' type_of ~msg ~expected ~actual) + +let literal_2 () = + let actual = + Get_type.literal _position + Get_type.[ T.Text "1"; T.Expression (Raw Integer) ] + and expected = Get_type.(Raw NumericString) in + let msg = "" in + Alcotest.(check' type_of ~msg ~expected ~actual) + +let literal_3 () = + let actual = + Get_type.literal _position + Get_type.[ T.Text "b"; T.Expression (Raw Integer) ] + and expected = Get_type.(Raw String) in + let msg = "" in + Alcotest.(check' type_of ~msg ~expected ~actual) + +let literal_4 () = + let actual = + Get_type.literal _position [ T.Expression (Get_type.Variable Integer) ] + and expected = Get_type.(Variable NumericString) in + let msg = "" in + Alcotest.(check' type_of ~msg ~expected ~actual) + let test = ( "Type expression", [ Alcotest.test_case "int + int" `Quick add_number; Alcotest.test_case "'int' + int" `Quick add_literal_number; Alcotest.test_case "str + int" `Quick concat_text; + Alcotest.test_case "<<int>>" `Quick literal_1; + Alcotest.test_case "1<<int>>" `Quick literal_2; + Alcotest.test_case "b<<int>>" `Quick literal_3; + Alcotest.test_case "<<$int>>" `Quick literal_4; ] ) |