Skip to content

Commit 2bf677f

Browse files
authored
Merge pull request #3137 from BuckleScript/more_tests_for_4.06
more tests to check 4.06 regression
2 parents 233a5dd + fc2e1ab commit 2bf677f

File tree

9 files changed

+575
-525
lines changed

9 files changed

+575
-525
lines changed

jscomp/core/lam_analysis.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ let rec no_side_effects (lam : Lam.t) : bool =
5959

6060
| "caml_create_string" (* TODO: add more *)
6161
| "caml_make_vect"
62+
| "caml_create_bytes"
6263
| "caml_obj_dup"
6364
| "caml_array_dup"
6465
| "caml_obj_block"

jscomp/test/bs_min_max_test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ eq("File \"bs_min_max_test.ml\", line 34, characters 5-12", Caml_obj.caml_max(un
8282

8383
b("File \"bs_min_max_test.ml\", line 35, characters 4-11", Caml_obj.caml_greaterequal(5, undefined));
8484

85+
b("File \"bs_min_max_test.ml\", line 36, characters 4-11", Caml_obj.caml_lessequal(undefined, 5));
86+
87+
b("File \"bs_min_max_test.ml\", line 37, characters 4-11", true);
88+
89+
b("File \"bs_min_max_test.ml\", line 38, characters 4-11", true);
90+
8591
Mt.from_pair_suites("bs_min_max_test.ml", suites[0]);
8692

8793
exports.suites = suites;

jscomp/test/bs_min_max_test.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ let () =
3232
eq __LOC__ (f5_min (Some 3) None) None;
3333
eq __LOC__ (f5_max (Some 3) None) (Some 3);
3434
eq __LOC__ (f5_max None (Some 3) ) (Some 3);
35-
b __LOC__ (Some 5 >= None) (*-FIXME 5 >= undefined*)
35+
b __LOC__ (Some 5 >= None) ;
36+
b __LOC__ (None <= Some 5);
37+
b __LOC__ (not (None = Some 5));
38+
b __LOC__ ( (None <> Some 5))
3639

3740
;; Mt.from_pair_suites __FILE__ !suites

jscomp/test/caml_compare_test.js

Lines changed: 531 additions & 508 deletions
Large diffs are not rendered by default.

jscomp/test/caml_compare_test.ml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ let function_equal_test = try ((fun x -> x + 1) = (fun x -> x + 2)) with
55
| Invalid_argument "equal: functional value" -> true
66
| _ -> false
77

8-
let suites = Mt.[
9-
__LOC__ , (fun _ -> Eq(true, None < Some 1)); (*-FIXME undefined < 1*)
8+
let suites = ref Mt.[
9+
__LOC__ , (fun _ -> Eq(true, None < Some 1));
1010
"option2", (fun _ -> Eq(true, Some 1 < Some 2));
11-
__LOC__, (fun _ -> Eq(true, [1] > [])); (*-FIXME Wrong specialization to [1] > 0 *)
11+
__LOC__, (fun _ -> Eq(true, [1] > []));
1212
"listeq", (fun _ -> Eq(true, [1;2;3] = [1;2;3]));
1313
"listneq", (fun _ -> Eq(true, [1;2;3] > [1;2;2]));
1414
"custom_u", (fun _ -> Eq(true, ( A 3 , B (2,false) , C 1) > ( A 3, B (2,false) , C 0 )));
1515
"custom_u2", (fun _ -> Eq(true, ( A 3 , B (2,false) , C 1) = ( A 3, B (2,false) , C 1 )));
1616
"function", (fun _ -> Eq(true, function_equal_test));
1717
__LOC__ , begin fun _ ->
18-
Eq(true, None < Some 1) (*-FIXME*)
18+
Eq(true, None < Some 1)
1919
end;
2020
(*JS WAT
2121
{[
@@ -26,10 +26,10 @@ let suites = Mt.[
2626
]}
2727
*)
2828
__LOC__, begin fun _ ->
29-
Eq(true, None < Some [|1;30|] ) (*-FIXME *)
29+
Eq(true, None < Some [|1;30|] )
3030
end;
3131
__LOC__, begin fun _ ->
32-
Eq(true, Some [|1;30|] > None ) (*-FIXME*)
32+
Eq(true, Some [|1;30|] > None )
3333
end;
3434
__LOC__ , begin fun _ ->
3535
Eq(true, [2;6;1;1;2;1;4;2;1] < [2;6;1;1;2;1;4;2;1;409])
@@ -38,7 +38,7 @@ let suites = Mt.[
3838
Eq(true, [1] < [1;409])
3939
end;
4040
__LOC__ , begin fun _ ->
41-
Eq(true, [] < [409]) (*-FIXME*)
41+
Eq(true, [] < [409])
4242
end;
4343
__LOC__ , begin fun _ ->
4444
Eq(true, [2;6;1;1;2;1;4;2;1;409] > [2;6;1;1;2;1;4;2;1])
@@ -106,5 +106,12 @@ let suites = Mt.[
106106
;;
107107

108108

109+
let test_id = ref 0
110+
let eq loc x y = Mt.eq_suites ~test_id ~suites loc x y
109111

110-
Mt.from_pair_suites __FILE__ suites
112+
;; eq __LOC__ true (Some 1 > None)
113+
;; eq __LOC__ true ([] < [1])
114+
;; eq __LOC__ false (None > Some 1)
115+
;; eq __LOC__ false (None > Some [|1;30|])
116+
;; eq __LOC__ false (Some [|1;30|] < None)
117+
let () = Mt.from_pair_suites __FILE__ !suites

jscomp/test/libarg_test.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,5 +128,5 @@ let suites = [];;
128128
let suites =
129129
Mt.[ "should raise", fun _ -> ThrowAny (fun _ -> test args2)]
130130
#end
131-
;; Mt.from_pair_suites __FILE__ suites
131+
let () = Mt.from_pair_suites __FILE__ suites
132132

jscomp/test/option_repr_test.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,13 @@ function f13$1(param) {
120120

121121
b("File \"option_repr_test.ml\", line 94, characters 4-11", Caml_obj.caml_lessthan(undefined, null));
122122

123-
b("File \"option_repr_test.ml\", line 95, characters 4-11", Caml_obj.caml_lessthan(undefined, Js_primitive.some(undefined)));
123+
b("File \"option_repr_test.ml\", line 95, characters 4-11", !Caml_obj.caml_greaterthan(undefined, null));
124+
125+
b("File \"option_repr_test.ml\", line 96, characters 4-11", Caml_obj.caml_greaterthan(null, undefined));
126+
127+
b("File \"option_repr_test.ml\", line 97, characters 4-11", Caml_obj.caml_lessthan(undefined, Js_primitive.some(undefined)));
128+
129+
b("File \"option_repr_test.ml\", line 98, characters 4-11", Caml_obj.caml_greaterthan(Js_primitive.some(undefined), undefined));
124130

125131
console.log(6, undefined);
126132

@@ -169,7 +175,7 @@ var xs = /* :: */[
169175
/* [] */0
170176
];
171177

172-
b("File \"option_repr_test.ml\", line 118, characters 5-12", Belt_List.every(xs, (function (x) {
178+
b("File \"option_repr_test.ml\", line 121, characters 5-12", Belt_List.every(xs, (function (x) {
173179
return x;
174180
})));
175181

@@ -214,7 +220,7 @@ var xs$1 = /* :: */[
214220
xs_001
215221
];
216222

217-
b("File \"option_repr_test.ml\", line 124, characters 5-12", Belt_List.every(xs$1, (function (x) {
223+
b("File \"option_repr_test.ml\", line 127, characters 5-12", Belt_List.every(xs$1, (function (x) {
218224
return x;
219225
})));
220226

@@ -239,7 +245,7 @@ var xs$2 = /* :: */[
239245
xs_001$1
240246
];
241247

242-
b("File \"option_repr_test.ml\", line 140, characters 5-12", Belt_List.every(xs$2, (function (x) {
248+
b("File \"option_repr_test.ml\", line 143, characters 5-12", Belt_List.every(xs$2, (function (x) {
243249
return x;
244250
})));
245251

jscomp/test/option_repr_test.ml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,12 @@ let f13 () =
9191

9292

9393
let () =
94-
b __LOC__ (None < Some Js.null); (*-FIXME*)
95-
b __LOC__ (None < Some Js.undefined)
96-
(*-FIXME always do commute tests to have a higher coverage *)
94+
b __LOC__ (None < Some Js.null);
95+
b __LOC__ (not (None > Some Js.null));
96+
b __LOC__ ( ( Some Js.null > None));
97+
b __LOC__ (None < Some Js.undefined);
98+
b __LOC__ ( Some Js.undefined > None);
99+
97100
external log3 :
98101
req:([ `String of string
99102
| `Int of int

lib/whole_compiler.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86711,6 +86711,7 @@ let rec no_side_effects (lam : Lam.t) : bool =
8671186711

8671286712
| "caml_create_string" (* TODO: add more *)
8671386713
| "caml_make_vect"
86714+
| "caml_create_bytes"
8671486715
| "caml_obj_dup"
8671586716
| "caml_array_dup"
8671686717
| "caml_obj_block"

0 commit comments

Comments
 (0)