From e953aa9b96a1eaeb6868e824f1b0d3e23f73fd9f Mon Sep 17 00:00:00 2001 From: Hongbo Zhang Date: Tue, 21 Jun 2016 15:22:12 -0400 Subject: [PATCH] add a unit test for propery name --- jscomp/test/.depend | 8 ++++---- jscomp/test/gpr_459.ml | 19 +++++++++++++++++++ jscomp/test/test.mllib | 2 +- lib/js/test/gpr_459.js | 43 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 67 insertions(+), 5 deletions(-) create mode 100644 jscomp/test/gpr_459.ml create mode 100644 lib/js/test/gpr_459.js diff --git a/jscomp/test/.depend b/jscomp/test/.depend index 763a592c81..0e7c27a9eb 100644 --- a/jscomp/test/.depend +++ b/jscomp/test/.depend @@ -224,6 +224,8 @@ gpr_405_test.cmj : ../stdlib/hashtbl.cmi gpr_405_test.cmi gpr_405_test.cmx : ../stdlib/hashtbl.cmx gpr_405_test.cmi gpr_441.cmj : gpr_441.cmx : +gpr_459.cmj : mt.cmi +gpr_459.cmx : mt.cmx guide_for_ext.cmj : guide_for_ext.cmx : hamming_test.cmj : ../stdlib/printf.cmi mt.cmi ../stdlib/lazy.cmi \ @@ -384,8 +386,6 @@ printf_sim.cmj : ../stdlib/printf.cmi printf_sim.cmx : ../stdlib/printf.cmx printf_test.cmj : ../stdlib/printf.cmi mt.cmi ../stdlib/format.cmi printf_test.cmx : ../stdlib/printf.cmx mt.cmx ../stdlib/format.cmx -promise.cmj : ../runtime/js.cmj -promise.cmx : ../runtime/js.cmx qcc.cmj : ../stdlib/sys.cmi ../stdlib/string.cmi ../stdlib/printf.cmi \ ../stdlib/list.cmi ../stdlib/char.cmi ../stdlib/bytes.cmi \ ../stdlib/array.cmi @@ -892,6 +892,8 @@ gpr_405_test.cmo : ../stdlib/hashtbl.cmi gpr_405_test.cmi gpr_405_test.cmj : ../stdlib/hashtbl.cmj gpr_405_test.cmi gpr_441.cmo : gpr_441.cmj : +gpr_459.cmo : mt.cmi +gpr_459.cmj : mt.cmj guide_for_ext.cmo : guide_for_ext.cmj : hamming_test.cmo : ../stdlib/printf.cmi mt.cmi ../stdlib/lazy.cmi \ @@ -1052,8 +1054,6 @@ printf_sim.cmo : ../stdlib/printf.cmi printf_sim.cmj : ../stdlib/printf.cmj printf_test.cmo : ../stdlib/printf.cmi mt.cmi ../stdlib/format.cmi printf_test.cmj : ../stdlib/printf.cmj mt.cmj ../stdlib/format.cmj -promise.cmo : ../runtime/js.cmo -promise.cmj : ../runtime/js.cmj qcc.cmo : ../stdlib/sys.cmi ../stdlib/string.cmi ../stdlib/printf.cmi \ ../stdlib/list.cmi ../stdlib/char.cmi ../stdlib/bytes.cmi \ ../stdlib/array.cmi diff --git a/jscomp/test/gpr_459.ml b/jscomp/test/gpr_459.ml new file mode 100644 index 0000000000..3455edc26e --- /dev/null +++ b/jscomp/test/gpr_459.ml @@ -0,0 +1,19 @@ +let suites : Mt.pair_suites ref = ref [] +let test_id = ref 0 +let eq loc x y = + incr test_id ; + suites := + (loc ^" id " ^ (string_of_int !test_id), (fun _ -> Mt.Eq(x,y))) :: !suites + + + +let uu = { + _'x_ = 3 +} [@bs.obj] + + +let hh = uu##_'x_ + +let () = eq __LOC__ hh 3 + +let () = Mt.from_pair_suites __FILE__ !suites diff --git a/jscomp/test/test.mllib b/jscomp/test/test.mllib index 67bf7f2316..5bce46b0f8 100644 --- a/jscomp/test/test.mllib +++ b/jscomp/test/test.mllib @@ -332,5 +332,5 @@ noassert test_unsafe_cmp gpr_441 - +gpr_459 promise \ No newline at end of file diff --git a/lib/js/test/gpr_459.js b/lib/js/test/gpr_459.js new file mode 100644 index 0000000000..30dd14f440 --- /dev/null +++ b/lib/js/test/gpr_459.js @@ -0,0 +1,43 @@ +// GENERATED CODE BY BUCKLESCRIPT VERSION 0.5.5 , PLEASE EDIT WITH CARE +'use strict'; + +var Mt = require("./mt"); +var Block = require("../block"); + +var suites = [/* [] */0]; + +var test_id = [0]; + +function eq(loc, x, y) { + test_id[0] = test_id[0] + 1 | 0; + suites[0] = /* :: */[ + /* tuple */[ + loc + (" id " + test_id[0]), + function () { + return /* Eq */Block.__(0, [ + x, + y + ]); + } + ], + suites[0] + ]; + return /* () */0; +} + +var uu = { + "'x": 3 +}; + +var hh = uu["'x"]; + +eq('File "gpr_459.ml", line 17, characters 12-19', hh, 3); + +Mt.from_pair_suites("gpr_459.ml", suites[0]); + +exports.suites = suites; +exports.test_id = test_id; +exports.eq = eq; +exports.uu = uu; +exports.hh = hh; +/* uu Not a pure module */