Skip to content

Commit 814391b

Browse files
committed
more parse tests
1 parent 75bc86e commit 814391b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

lib/parse_tests.ml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,20 @@ let%expect_test _ =
4343
(Bin_list (Variable x) ((+ -1 (Number 10))))))) |}];
4444
print_parsed "5 + #some comment\n5;";
4545
[%expect {| (Expr (Function (Prototype "" ()) (Bin_list (Number 5) ((+ -1 (Number 5)))))) |}];
46+
print_parsed "def test(x) 1+2+x;";
47+
[%expect {|
48+
(Def
49+
(Function (Prototype test (x))
50+
(Bin_list (Number 1) ((+ -1 (Number 2)) (+ -1 (Variable x)))))) |}];
51+
print_parsed "def test(x) (1+2+x)*(x+(1+2));";
52+
[%expect {|
53+
(Def
54+
(Function (Prototype test (x))
55+
(Bin_list (Bin_list (Number 1) ((+ -1 (Number 2)) (+ -1 (Variable x))))
56+
((* -1
57+
(Bin_list (Variable x)
58+
((+ -1 (Bin_list (Number 1) ((+ -1 (Number 2)))))))))))) |}];
59+
print_parsed "foo(2);";
60+
[%expect {| (Expr (Function (Prototype "" ()) (Call foo ((Number 2))))) |}];
61+
print_parsed "extern sin(x);";
62+
[%expect {| (Extern (Prototype sin (x))) |}];

0 commit comments

Comments
 (0)