Skip to content

Commit 4cfa946

Browse files
authored
Merge pull request #460 from bloomberg/div_by_zero
add a unit test for propery name
2 parents e78c67a + 73e398c commit 4cfa946

File tree

4 files changed

+89
-5
lines changed

4 files changed

+89
-5
lines changed

jscomp/test/.depend

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@ gpr_405_test.cmj : ../stdlib/hashtbl.cmi gpr_405_test.cmi
224224
gpr_405_test.cmx : ../stdlib/hashtbl.cmx gpr_405_test.cmi
225225
gpr_441.cmj :
226226
gpr_441.cmx :
227+
gpr_459_test.cmj : mt.cmi
228+
gpr_459_test.cmx : mt.cmx
227229
guide_for_ext.cmj :
228230
guide_for_ext.cmx :
229231
hamming_test.cmj : ../stdlib/printf.cmi mt.cmi ../stdlib/lazy.cmi \
@@ -384,8 +386,6 @@ printf_sim.cmj : ../stdlib/printf.cmi
384386
printf_sim.cmx : ../stdlib/printf.cmx
385387
printf_test.cmj : ../stdlib/printf.cmi mt.cmi ../stdlib/format.cmi
386388
printf_test.cmx : ../stdlib/printf.cmx mt.cmx ../stdlib/format.cmx
387-
promise.cmj : ../runtime/js.cmj
388-
promise.cmx : ../runtime/js.cmx
389389
qcc.cmj : ../stdlib/sys.cmi ../stdlib/string.cmi ../stdlib/printf.cmi \
390390
../stdlib/list.cmi ../stdlib/char.cmi ../stdlib/bytes.cmi \
391391
../stdlib/array.cmi
@@ -892,6 +892,8 @@ gpr_405_test.cmo : ../stdlib/hashtbl.cmi gpr_405_test.cmi
892892
gpr_405_test.cmj : ../stdlib/hashtbl.cmj gpr_405_test.cmi
893893
gpr_441.cmo :
894894
gpr_441.cmj :
895+
gpr_459_test.cmo : mt.cmi
896+
gpr_459_test.cmj : mt.cmj
895897
guide_for_ext.cmo :
896898
guide_for_ext.cmj :
897899
hamming_test.cmo : ../stdlib/printf.cmi mt.cmi ../stdlib/lazy.cmi \
@@ -1052,8 +1054,6 @@ printf_sim.cmo : ../stdlib/printf.cmi
10521054
printf_sim.cmj : ../stdlib/printf.cmj
10531055
printf_test.cmo : ../stdlib/printf.cmi mt.cmi ../stdlib/format.cmi
10541056
printf_test.cmj : ../stdlib/printf.cmj mt.cmj ../stdlib/format.cmj
1055-
promise.cmo : ../runtime/js.cmo
1056-
promise.cmj : ../runtime/js.cmj
10571057
qcc.cmo : ../stdlib/sys.cmi ../stdlib/string.cmi ../stdlib/printf.cmi \
10581058
../stdlib/list.cmi ../stdlib/char.cmi ../stdlib/bytes.cmi \
10591059
../stdlib/array.cmi

jscomp/test/gpr_459_test.ml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[@@@bs.config{non_export=true}]
2+
3+
let suites : Mt.pair_suites ref = ref []
4+
let test_id = ref 0
5+
let eq loc x y =
6+
incr test_id ;
7+
suites :=
8+
(loc ^" id " ^ (string_of_int !test_id), (fun _ -> Mt.Eq(x,y))) :: !suites
9+
10+
11+
12+
let uu = {
13+
_'x_ = 3;
14+
15+
} [@bs.obj]
16+
17+
let uu2 = {
18+
then_ = 1;
19+
catch = 2;
20+
_'x_ = 3
21+
} [@bs.obj]
22+
23+
let hh = uu##_'x_
24+
25+
let () = eq __LOC__ hh 3
26+
27+
let () =
28+
eq __LOC__ (1,2,3) (uu2##then_, uu2##catch, uu2##_'x_)
29+
30+
let () = Mt.from_pair_suites __FILE__ !suites

jscomp/test/test.mllib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,5 +332,5 @@ noassert
332332
test_unsafe_cmp
333333

334334
gpr_441
335-
335+
gpr_459_test
336336
promise

lib/js/test/gpr_459_test.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// GENERATED CODE BY BUCKLESCRIPT VERSION 0.5.5 , PLEASE EDIT WITH CARE
2+
'use strict';
3+
4+
var Mt = require("./mt");
5+
var Block = require("../block");
6+
7+
var suites = [/* [] */0];
8+
9+
var test_id = [0];
10+
11+
function eq(loc, x, y) {
12+
test_id[0] = test_id[0] + 1 | 0;
13+
suites[0] = /* :: */[
14+
/* tuple */[
15+
loc + (" id " + test_id[0]),
16+
function () {
17+
return /* Eq */Block.__(0, [
18+
x,
19+
y
20+
]);
21+
}
22+
],
23+
suites[0]
24+
];
25+
return /* () */0;
26+
}
27+
28+
var uu = {
29+
"'x": 3
30+
};
31+
32+
var uu2 = {
33+
then: 1,
34+
catch: 2,
35+
"'x": 3
36+
};
37+
38+
var hh = uu["'x"];
39+
40+
eq('File "gpr_459_test.ml", line 25, characters 12-19', hh, 3);
41+
42+
eq('File "gpr_459_test.ml", line 28, characters 5-12', /* tuple */[
43+
1,
44+
2,
45+
3
46+
], /* tuple */[
47+
uu2.then,
48+
uu2.catch,
49+
uu2["'x"]
50+
]);
51+
52+
Mt.from_pair_suites("gpr_459_test.ml", suites[0]);
53+
54+
/* uu Not a pure module */

0 commit comments

Comments
 (0)