Skip to content

Commit ef47891

Browse files
committed
fix ci
1 parent 2ac1b51 commit ef47891

15 files changed

+122
-104
lines changed

jscomp/bin/all_ounit_tests.ml

+36-30
Original file line numberDiff line numberDiff line change
@@ -4002,10 +4002,10 @@ let merge t1 t2 =
40024002
bal t1 x d (remove_min_binding t2)
40034003

40044004

4005-
let rec iter f = function
4005+
let rec iter x f = match x with
40064006
Empty -> ()
40074007
| Node(l, v, d, r, _) ->
4008-
iter f l; f v d; iter f r
4008+
iter l f; f v d; iter r f
40094009

40104010
let rec map f = function
40114011
Empty ->
@@ -4173,7 +4173,7 @@ module type S =
41734173

41744174
val equal: ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
41754175

4176-
val iter: (key -> 'a -> unit) -> 'a t -> unit
4176+
val iter: 'a t -> (key -> 'a -> unit) -> unit
41774177
(** [iter f m] applies [f] to all bindings in map [m].
41784178
The bindings are passed to [f] in increasing order. *)
41794179

@@ -7285,12 +7285,12 @@ let encode_single (x : Bsb_db.t) (buf : Buffer.t) (buf2 : Buffer.t) =
72857285
let len = String_map.cardinal x in
72867286
nl buf ;
72877287
Buffer.add_string buf (string_of_int len);
7288-
String_map.iter (fun name module_info ->
7288+
String_map.iter x (fun name module_info ->
72897289
nl buf;
72907290
Buffer.add_string buf name;
72917291
nl buf2;
72927292
encode_module_info module_info buf2
7293-
) x
7293+
)
72947294

72957295
let encode (x : Bsb_db.ts) (oc : out_channel)=
72967296
output_char oc '\n';
@@ -7415,6 +7415,33 @@ let printer_string = fun x -> x
74157415
let (=~) = OUnit.assert_equal ~printer:printer_string
74167416

74177417

7418+
let parse_data_one =
7419+
(Bsb_db_io.decode {|4.0.19
7420+
2
7421+
1
7422+
Demo
7423+
src/demo,01
7424+
1
7425+
Test
7426+
examples/test,01
7427+
|} (ref 7))
7428+
7429+
let parse_data_two =
7430+
Bsb_db_io.decode {|4.0.19
7431+
3
7432+
2
7433+
Fib
7434+
Demo
7435+
src/hi/fib,01
7436+
src/demo,01
7437+
0
7438+
0|} (ref 7)
7439+
let data_one : Bsb_db_io.group array =
7440+
[| {modules = [|"Demo"|]; meta_info_offset = 16}; {modules = [|"Test"|]; meta_info_offset = 35}|]
7441+
7442+
let data_two : Bsb_db_io.group array =
7443+
[| {modules = [|"Fib"; "Demo"|]; meta_info_offset = 20 }; {modules = [||]; meta_info_offset = 48}; {modules = [||]; meta_info_offset = -1} |]
7444+
74187445

74197446
let scope_test s (a,b,c)=
74207447
match Bsb_pkg_types.extract_pkg_name_and_file s with
@@ -7469,32 +7496,11 @@ let suites =
74697496
s_test1 "xx/yy/zz" "xx/yy/zz"
74707497
end;
74717498
__LOC__ >:: begin fun _ ->
7472-
let u = (Bsb_db_io.decode {|4.0.19
7473-
2
7474-
1
7475-
Demo
7476-
0
7477-
src/demo,0,0
7478-
1
7479-
Test
7480-
0
7481-
examples/test,0,0
7482-
|} (ref 7)) in
7483-
OUnit.assert_equal u [| {modules = [|"Demo"|]; meta_info_offset = 16}; {modules = [|"Test"|]; meta_info_offset = 38}|]
7499+
OUnit.assert_equal parse_data_one data_one
74847500
end ;
74857501
__LOC__ >:: begin fun _ ->
7486-
let v = Bsb_db_io.decode {|4.0.19
7487-
3
7488-
2
7489-
Fib
7490-
Demo
7491-
0
7492-
src/hi/fib,0,0
7493-
0
7494-
src/demo,0,0
7495-
0
7496-
0|} (ref 7) in
7497-
OUnit.assert_equal v [| {modules = [|"Fib"; "Demo"|]; meta_info_offset = 20 }; {modules = [||]; meta_info_offset = 54}; {modules = [||]; meta_info_offset = -1} |]
7502+
7503+
OUnit.assert_equal parse_data_two data_two
74987504
end
74997505
]
75007506

@@ -13982,7 +13988,7 @@ let suites =
1398213988
Array.fold_left (fun acc key -> Int_map.adjust acc key (fun v -> match v with None -> 1 | Some v -> succ v) ) v a
1398313989
end
1398413990
in
13985-
Int_map.iter (fun _ v -> v =~ 2 ) u ;
13991+
Int_map.iter u (fun _ v -> v =~ 2 ) ;
1398613992
Int_map.cardinal u =~ count
1398713993
end
1398813994
]

jscomp/bin/bsb_native.ml

+8-8
Original file line numberDiff line numberDiff line change
@@ -1894,10 +1894,10 @@ let merge t1 t2 =
18941894
bal t1 x d (remove_min_binding t2)
18951895

18961896

1897-
let rec iter f = function
1897+
let rec iter x f = match x with
18981898
Empty -> ()
18991899
| Node(l, v, d, r, _) ->
1900-
iter f l; f v d; iter f r
1900+
iter l f; f v d; iter r f
19011901

19021902
let rec map f = function
19031903
Empty ->
@@ -2065,7 +2065,7 @@ module type S =
20652065

20662066
val equal: ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
20672067

2068-
val iter: (key -> 'a -> unit) -> 'a t -> unit
2068+
val iter: 'a t -> (key -> 'a -> unit) -> unit
20692069
(** [iter f m] applies [f] to all bindings in map [m].
20702070
The bindings are passed to [f] in increasing order. *)
20712071

@@ -12473,12 +12473,12 @@ let encode_single (x : Bsb_db.t) (buf : Buffer.t) (buf2 : Buffer.t) =
1247312473
let len = String_map.cardinal x in
1247412474
nl buf ;
1247512475
Buffer.add_string buf (string_of_int len);
12476-
String_map.iter (fun name module_info ->
12476+
String_map.iter x (fun name module_info ->
1247712477
nl buf;
1247812478
Buffer.add_string buf name;
1247912479
nl buf2;
1248012480
encode_module_info module_info buf2
12481-
) x
12481+
)
1248212482

1248312483
let encode (x : Bsb_db.ts) (oc : out_channel)=
1248412484
output_char oc '\n';
@@ -12666,10 +12666,10 @@ let output ~dir namespace
1266612666
let oc = open_out_bin (dir// fname ) in
1266712667
List.iter
1266812668
(fun (x : Bsb_file_groups.file_group) ->
12669-
String_map.iter (fun k _ ->
12669+
String_map.iter x.sources (fun k _ ->
1267012670
output_string oc k ;
1267112671
output_string oc "\n"
12672-
) x.sources
12672+
)
1267312673
) file_groups ;
1267412674
close_out oc
1267512675
end
@@ -13850,7 +13850,7 @@ let output_ninja_and_namespace_map
1385013850
for i = 1 to number_of_dev_groups do
1385113851
let c = bs_groups.(i) in
1385213852
has_reason_files := Bsb_db.sanity_check c || !has_reason_files ;
13853-
String_map.iter (fun k _ -> if String_map.mem k lib then failwith ("conflict files found:" ^ k)) c ;
13853+
String_map.iter c (fun k _ -> if String_map.mem k lib then failwith ("conflict files found:" ^ k)) ;
1385413854
Bsb_ninja_util.output_kv
1385513855
(Bsb_dir_index.(string_of_bsb_dev_include (of_int i)))
1385613856
(Bsb_build_util.include_dirs @@ source_dirs.(i)) oc

jscomp/bin/bspack.ml

+3-3
Original file line numberDiff line numberDiff line change
@@ -8544,10 +8544,10 @@ let merge t1 t2 =
85448544
bal t1 x d (remove_min_binding t2)
85458545

85468546

8547-
let rec iter f = function
8547+
let rec iter x f = match x with
85488548
Empty -> ()
85498549
| Node(l, v, d, r, _) ->
8550-
iter f l; f v d; iter f r
8550+
iter l f; f v d; iter r f
85518551

85528552
let rec map f = function
85538553
Empty ->
@@ -8715,7 +8715,7 @@ module type S =
87158715

87168716
val equal: ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
87178717

8718-
val iter: (key -> 'a -> unit) -> 'a t -> unit
8718+
val iter: 'a t -> (key -> 'a -> unit) -> unit
87198719
(** [iter f m] applies [f] to all bindings in map [m].
87208720
The bindings are passed to [f] in increasing order. *)
87218721

jscomp/bsb/bsb_db_io.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ let encode_single (x : Bsb_db.t) (buf : Buffer.t) (buf2 : Buffer.t) =
9898
let len = String_map.cardinal x in
9999
nl buf ;
100100
Buffer.add_string buf (string_of_int len);
101-
String_map.iter (fun name module_info ->
101+
String_map.iter x (fun name module_info ->
102102
nl buf;
103103
Buffer.add_string buf name;
104104
nl buf2;
105105
encode_module_info module_info buf2
106-
) x
106+
)
107107

108108
let encode (x : Bsb_db.ts) (oc : out_channel)=
109109
output_char oc '\n';

jscomp/bsb/bsb_namespace_map_gen.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ let output ~dir namespace
3636
let oc = open_out_bin (dir// fname ) in
3737
List.iter
3838
(fun (x : Bsb_file_groups.file_group) ->
39-
String_map.iter (fun k _ ->
39+
String_map.iter x.sources (fun k _ ->
4040
output_string oc k ;
4141
output_string oc "\n"
42-
) x.sources
42+
)
4343
) file_groups ;
4444
close_out oc

jscomp/bsb/bsb_ninja_gen.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ let output_ninja_and_namespace_map
206206
for i = 1 to number_of_dev_groups do
207207
let c = bs_groups.(i) in
208208
has_reason_files := Bsb_db.sanity_check c || !has_reason_files ;
209-
String_map.iter (fun k _ -> if String_map.mem k lib then failwith ("conflict files found:" ^ k)) c ;
209+
String_map.iter c (fun k _ -> if String_map.mem k lib then failwith ("conflict files found:" ^ k)) ;
210210
Bsb_ninja_util.output_kv
211211
(Bsb_dir_index.(string_of_bsb_dev_include (of_int i)))
212212
(Bsb_build_util.include_dirs @@ source_dirs.(i)) oc

jscomp/ext/ext_pp_scope.ml

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ let empty =
3939

4040
let rec print fmt v =
4141
Format.fprintf fmt "@[<v>{" ;
42-
String_map.iter (fun k m ->
42+
String_map.iter v (fun k m ->
4343
Format.fprintf fmt "%s: @[%a@],@ " k print_int_map m
44-
) v;
44+
) ;
4545
Format.fprintf fmt "}@]"
4646
and print_int_map fmt m =
47-
Int_map.iter (fun k v ->
47+
Int_map.iter m (fun k v ->
4848
Format.fprintf fmt "%d - %d" k v
49-
) m
49+
)
5050

5151
let add_ident ~mangled:name stamp (cxt : t) : int * t =
5252
match String_map.find_opt name cxt with

jscomp/ext/map_gen.ml

+3-3
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ let merge t1 t2 =
137137
bal t1 x d (remove_min_binding t2)
138138

139139

140-
let rec iter f = function
140+
let rec iter x f = match x with
141141
Empty -> ()
142142
| Node(l, v, d, r, _) ->
143-
iter f l; f v d; iter f r
143+
iter l f; f v d; iter r f
144144

145145
let rec map f = function
146146
Empty ->
@@ -308,7 +308,7 @@ module type S =
308308

309309
val equal: ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
310310

311-
val iter: (key -> 'a -> unit) -> 'a t -> unit
311+
val iter: 'a t -> (key -> 'a -> unit) -> unit
312312
(** [iter f m] applies [f] to all bindings in map [m].
313313
The bindings are passed to [f] in increasing order. *)
314314

jscomp/ounit_tests/ounit_bsb_pkg_tests.ml

+36-24
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,40 @@ let printer_string = fun x -> x
77
let (=~) = OUnit.assert_equal ~printer:printer_string
88

99

10+
let parse_data_one =
11+
(Bsb_db_io.decode {|4.0.19
12+
2
13+
1
14+
Demo
15+
src/demo,01
16+
1
17+
Test
18+
examples/test,01
19+
|} (ref 7))
20+
21+
let parse_data_two =
22+
Bsb_db_io.decode {|4.0.19
23+
3
24+
2
25+
Fib
26+
Demo
27+
src/hi/fib,01
28+
src/demo,01
29+
0
30+
0|} (ref 7)
31+
let data_one : Bsb_db_io.group array =
32+
[| {modules = [|"Demo"|]; meta_info_offset = 16}; {modules = [|"Test"|]; meta_info_offset = 35}|]
1033

34+
let data_two : Bsb_db_io.group array =
35+
[| {modules = [|"Fib"; "Demo"|]; meta_info_offset = 20 }; {modules = [||]; meta_info_offset = 48}; {modules = [||]; meta_info_offset = -1} |]
36+
37+
#if 0 then
38+
let () =
39+
Format.fprintf Format.err_formatter
40+
"hi\n%a@.%a\n@."
41+
Ext_obj.pp_any parse_data_one
42+
Ext_obj.pp_any parse_data_two
43+
#end
1144
let scope_test s (a,b,c)=
1245
match Bsb_pkg_types.extract_pkg_name_and_file s with
1346
| Scope(a0,b0),c0 ->
@@ -61,32 +94,11 @@ let suites =
6194
s_test1 "xx/yy/zz" "xx/yy/zz"
6295
end;
6396
__LOC__ >:: begin fun _ ->
64-
let u = (Bsb_db_io.decode {|4.0.19
65-
2
66-
1
67-
Demo
68-
0
69-
src/demo,0,0
70-
1
71-
Test
72-
0
73-
examples/test,0,0
74-
|} (ref 7)) in
75-
OUnit.assert_equal u [| {modules = [|"Demo"|]; meta_info_offset = 16}; {modules = [|"Test"|]; meta_info_offset = 38}|]
97+
OUnit.assert_equal parse_data_one data_one
7698
end ;
7799
__LOC__ >:: begin fun _ ->
78-
let v = Bsb_db_io.decode {|4.0.19
79-
3
80-
2
81-
Fib
82-
Demo
83-
0
84-
src/hi/fib,0,0
85-
0
86-
src/demo,0,0
87-
0
88-
0|} (ref 7) in
89-
OUnit.assert_equal v [| {modules = [|"Fib"; "Demo"|]; meta_info_offset = 20 }; {modules = [||]; meta_info_offset = 54}; {modules = [||]; meta_info_offset = -1} |]
100+
101+
OUnit.assert_equal parse_data_two data_two
90102
end
91103
]
92104

jscomp/ounit_tests/ounit_map_tests.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ let suites =
5353
Array.fold_left (fun acc key -> Int_map.adjust acc key (fun v -> match v with None -> 1 | Some v -> succ v) ) v a
5454
end
5555
in
56-
Int_map.iter (fun _ v -> v =~ 2 ) u ;
56+
Int_map.iter u (fun _ v -> v =~ 2 ) ;
5757
Int_map.cardinal u =~ count
5858
end
5959
]

0 commit comments

Comments
 (0)