Skip to content

Commit 0cfea65

Browse files
committed
add tests
1 parent 7425583 commit 0cfea65

File tree

4 files changed

+58
-3
lines changed

4 files changed

+58
-3
lines changed

jscomp/test/.depend

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ test_incr_ref.cmj :
554554
test_index.cmj : ../runtime/js.cmj
555555
test_int_map_find.cmj :
556556
test_internalOO.cmj :
557-
test_is_js.cmj : test_is_js.cmi
557+
test_is_js.cmj : mt.cmj test_is_js.cmi
558558
test_js_ffi.cmj :
559559
test_let.cmj :
560560
test_list.cmj :

jscomp/test/gpr_3142_test.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ let v,u = tToJs, tFromJs
1515

1616

1717
(* not applicable to thiis type, and unused warning*)
18-
#if false then
18+
#if 0 then
1919
type t0 =
2020
[ `a of int [@bs.as "hi"] ]
2121
[@@bs.deriving jsConverter]

jscomp/test/test_is_js.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,21 @@
1-
/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */
1+
'use strict';
2+
3+
var Mt = require("./mt.js");
4+
5+
var suites = /* record */[/* contents : [] */0];
6+
7+
var test_id = /* record */[/* contents */0];
8+
9+
function b(loc, x) {
10+
return Mt.bool_suites(test_id, suites, loc, x);
11+
}
12+
13+
b("File \"test_is_js.ml\", line 15, characters 2-9", true);
14+
15+
b("File \"test_is_js.ml\", line 23, characters 2-9", true);
16+
17+
b("File \"test_is_js.ml\", line 37, characters 2-9", true);
18+
19+
Mt.from_pair_suites("test_is_js.ml", suites[0]);
20+
21+
/* Not a pure module */

jscomp/test/test_is_js.ml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,38 @@ let v =
44
#else
55
false
66
#end
7+
8+
let suites : Mt.pair_suites ref = ref []
9+
let test_id = ref 0
10+
let eq loc x y = Mt.eq_suites ~test_id ~suites loc x y
11+
let b loc x = Mt.bool_suites ~test_id ~suites loc x;;
12+
13+
14+
#if 1 then
15+
b __LOC__ true;;
16+
#end
17+
18+
#if 0 then
19+
b __LOC__ false ;;
20+
#end
21+
22+
#if 1 > 0 then
23+
b __LOC__ true;;
24+
#end
25+
26+
27+
#if 1 < 0 then
28+
b __LOC__ false;;
29+
#end
30+
31+
#if 0 > 1 then
32+
b __LOC__ false;;
33+
#end
34+
35+
36+
#if 0 < 1 then
37+
b __LOC__ true;;
38+
#end
39+
40+
41+
let () = Mt.from_pair_suites __FILE__ !suites

0 commit comments

Comments
 (0)