Debian Codegraph @

test/errors.mlt

raw
1 module Test_double_else = struct
2
3 [%% if true ]
4 let x = 1
5 [%% else ]
6 let x = 2
7 [%% else ]
8 let x = 3
9 [%% endif]
10
11 end
12 [%%expect{|
13 Line _, characters _-_:
14 Error: optcomp: second else clause.
15 |}]
16
17 module Test_else_elif = struct
18
19 [%% if true ]
20 let x = 1
21 [%% else ]
22 let x = 2
23 [%% elif false ]
24 let x = 3
25 [%% endif]
26
27 end
28 [%%expect{|
29 Line _, characters _-_:
30 Error: optcomp: elif after else clause.
31 |}]
32
33 module Test_unterminated_if = struct
34
35 [%% if true ]
36 let x = a
37
38 end
39 [%%expect{|
40 Line _, characters _-_:
41 Error: optcomp: unterminated if
42 |}]
43
44 module Test_import_nonexistent = struct
45
46 [%% import "non_existent_file.h"]
47
48 end
49 [%%expect{|
50 Line _, characters _-_:
51 Error: optcomp: cannot open imported file: ./non_existent_file.h: ./non_existent_file.h: No such file or directory
52 |}]