Debian Codegraph @

test-suite/unit-tests/lib/coqProject.ml

raw symbols SCIP
1 open OUnit
2 open Utest
3 open CoqProject_file
4
5 let tests = ref []
6 let add_test name test = tests := (mk_test name (TestCase test)) :: !tests
7
8 let sourced_file x = { thing = x; source = ProjectFile }
9
10 (* Implicit argument for `read_project_file` *)
11 let warning_fn _ = ()
12
13 let t () =
14 let project_file_contents = "" in
15 bracket_tmpfile
16 (fun (project_file_path, project_file_channel) ->
17 output_string project_file_channel project_file_contents;
18 flush project_file_channel;
19 let expected : unit project = {
20 project_file = Some project_file_path;
21 makefile = None;
22 native_compiler = None;
23 docroot = None;
24
25 files = [];
26 cmd_line_files = [];
27 meta_file = Absent;
28
29 ml_includes = [];
30 r_includes = [];
31 q_includes = [];
32 extra_args = [];
33 defs = [];
34
35 extra_data = ();
36 } in
37 assert_equal expected (read_project_file ~warning_fn project_file_path)
38 ) ()
39 let _ = add_test "empty file" t
40
41 let t () =
42 let project_file_contents = "-arg \"-w default\" -arg -w -arg foo -arg \"-set 'Default Goal Selector=!'\"" in
43 bracket_tmpfile
44 (fun (project_file_path, project_file_channel) ->
45 output_string project_file_channel project_file_contents;
46 flush project_file_channel;
47 let expected : unit project = {
48 project_file = Some project_file_path;
49 makefile = None;
50 native_compiler = None;
51 docroot = None;
52
53 files = [];
54 cmd_line_files = [];
55 meta_file = Absent;
56
57 ml_includes = [];
58 r_includes = [];
59 q_includes = [];
60 extra_args = List.map sourced_file ["-w"; "default"; "-w"; "foo"; "-set"; "Default Goal Selector=!"];
61 defs = [];
62
63 extra_data = ();
64 } in
65 assert_equal expected (read_project_file ~warning_fn project_file_path)
66 ) ()
67 let _ = add_test "-arg separation" t
68
69 let _ = run_tests __FILE__ (open_log_out_ch __FILE__) (List.rev !tests)