@@ -31,7 +31,24 @@ let s_test1 s a =
31
31
| Global x ->
32
32
a =~ x
33
33
| _ -> OUnit. assert_failure __LOC__
34
-
34
+
35
+ let group0 = Map_string. of_list [
36
+ " Liba" ,
37
+ {Bsb_db. info = Ml_mli ; dir= " a" ;is_re= false ;case = false ;
38
+ name_sans_extension = " liba" }
39
+ ]
40
+ let group1 = Map_string. of_list [
41
+ " Ciba" ,
42
+ {Bsb_db. info = Ml_mli ; dir= " b" ;is_re= false ;case = false ;
43
+ name_sans_extension = " liba" }
44
+ ]
45
+
46
+ let parse_db db : Bsb_db_decode.t =
47
+ let buf = Ext_buffer. create 10_000 in
48
+ Bsb_db_encode. encode db buf;
49
+ let s = Ext_buffer. contents buf in
50
+ Bsb_db_decode. decode s
51
+
35
52
let suites =
36
53
__FILE__ > ::: [
37
54
__LOC__ > :: begin fun _ ->
@@ -60,6 +77,31 @@ let suites =
60
77
s_test1 " xx/yy/zz" " xx/yy/zz"
61
78
end;
62
79
80
+ __LOC__ > :: begin fun _ ->
81
+ match parse_db {lib= group0; dev = group1}with
82
+ | {lib = Group {modules = [|" Liba" |]};
83
+ dev = Group {modules = [|" Ciba" |]}}
84
+ -> OUnit. assert_bool __LOC__ true
85
+ | _ ->
86
+ OUnit. assert_failure __LOC__
87
+ end ;
88
+ __LOC__ > :: begin fun _ ->
89
+ match parse_db {lib = group0;dev = Map_string. empty } with
90
+ | {lib = Group {modules = [|" Liba" |]};
91
+ dev = Dummy }
92
+ -> OUnit. assert_bool __LOC__ true
93
+ | _ ->
94
+ OUnit. assert_failure __LOC__
95
+ end ;
96
+ __LOC__ > :: begin fun _ ->
97
+ match parse_db {lib = Map_string. empty ; dev = group1} with
98
+ | {lib = Dummy ;
99
+ dev = Group {modules = [|" Ciba" |]}
100
+ }
101
+ -> OUnit. assert_bool __LOC__ true
102
+ | _ ->
103
+ OUnit. assert_failure __LOC__
104
+ end
63
105
(* __LOC__ >:: begin fun _ ->
64
106
OUnit.assert_equal parse_data_one data_one
65
107
end ;
0 commit comments