Skip to content

Commit bd2adf8

Browse files
committed
update test cases
1 parent a7a95e2 commit bd2adf8

File tree

3 files changed

+63
-4
lines changed

3 files changed

+63
-4
lines changed

jscomp/test/.depend

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ gpr_1728_test.cmj : mt.cmj
237237
gpr_1749_test.cmj : mt.cmj
238238
gpr_1759_test.cmj :
239239
gpr_1760_test.cmj :
240-
gpr_1762_test.cmj :
240+
gpr_1762_test.cmj : mt.cmj
241241
gpr_405_test.cmj : ../stdlib/hashtbl.cmj gpr_405_test.cmi
242242
gpr_441.cmj :
243243
gpr_459_test.cmj : mt.cmj

jscomp/test/gpr_1762_test.js

+40-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,45 @@
11
'use strict';
22

3-
var Pervasives = require("../../lib/js/pervasives.js");
3+
var Mt = require("./mt.js");
4+
var Block = require("../../lib/js/block.js");
45

5-
Pervasives.bool_of_string("x");
6+
var suites = [/* [] */0];
67

8+
var test_id = [0];
9+
10+
function eq(loc, x, y) {
11+
test_id[0] = test_id[0] + 1 | 0;
12+
suites[0] = /* :: */[
13+
/* tuple */[
14+
loc + (" id " + test_id[0]),
15+
(function () {
16+
return /* Eq */Block.__(0, [
17+
x,
18+
y
19+
]);
20+
})
21+
],
22+
suites[0]
23+
];
24+
return /* () */0;
25+
}
26+
27+
var v = [3];
28+
29+
function update() {
30+
v[0] = v[0] + 1 | 0;
31+
return /* true */1;
32+
}
33+
34+
v[0] = v[0] + 1 | 0;
35+
36+
eq("File \"gpr_1762_test.ml\", line 22, characters 6-13", v[0], 4);
37+
38+
Mt.from_pair_suites("gpr_1762_test.ml", suites[0]);
39+
40+
exports.suites = suites;
41+
exports.test_id = test_id;
42+
exports.eq = eq;
43+
exports.v = v;
44+
exports.update = update;
745
/* Not a pure module */

jscomp/test/gpr_1762_test.ml

+22-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
11

22

33

4-
if bool_of_string "x" then "" else ""
4+
(*;; if bool_of_string "x" then "" else "" *)
5+
6+
7+
8+
let suites : Mt.pair_suites ref = ref []
9+
let test_id = ref 0
10+
let eq loc x y =
11+
incr test_id ;
12+
suites :=
13+
(loc ^" id " ^ (string_of_int !test_id), (fun _ -> Mt.Eq(x,y))) :: !suites
14+
15+
16+
let v = ref 3
17+
18+
let update () = incr v ; true
19+
20+
;; if update () then "" else ""
21+
22+
;; eq __LOC__ !v 4
23+
24+
25+
;; Mt.from_pair_suites __FILE__ !suites

0 commit comments

Comments
 (0)