Skip to content

Commit

Permalink
[fix] fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Hongbo Zhang committed May 18, 2016
1 parent f480471 commit ef1111e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
8 changes: 4 additions & 4 deletions jscomp/test/.depend
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ js_date.cmj : ../runtime/js.cmj
js_date.cmx : ../runtime/js.cmx
js_date_test.cmj : mt.cmi js_date.cmj
js_date_test.cmx : mt.cmx js_date.cmx
js_obj_test.cmj : mt.cmi
js_obj_test.cmx : mt.cmx
js_obj_test.cmj : mt.cmi ../runtime/js.cmj
js_obj_test.cmx : mt.cmx ../runtime/js.cmx
js_val.cmj :
js_val.cmx :
lam_current_unit.cmj : ../stdlib/string.cmi ../stdlib/filename.cmi
Expand Down Expand Up @@ -916,8 +916,8 @@ js_date.cmo : ../runtime/js.cmo
js_date.cmj : ../runtime/js.cmj
js_date_test.cmo : mt.cmi js_date.cmo
js_date_test.cmj : mt.cmj js_date.cmj
js_obj_test.cmo : mt.cmi
js_obj_test.cmj : mt.cmj
js_obj_test.cmo : mt.cmi ../runtime/js.cmo
js_obj_test.cmj : mt.cmj ../runtime/js.cmj
js_val.cmo :
js_val.cmj :
lam_current_unit.cmo : ../stdlib/string.cmi ../stdlib/filename.cmi
Expand Down
8 changes: 5 additions & 3 deletions jscomp/test/js_obj_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ class type x =

let f (u : x ) = u # say 32

let f_js u = u##say 32

let suites = Mt.[
"caml_obj", (fun _ -> Eq (33, f (object method say x = 1 + x end)));
"js_obj", (fun _ -> let module N =
struct
external mk : say:'a -> <say:'a> = ""[@@bs.obj]
external mk : say:'a -> <say:'a> Js.t = ""[@@bs.obj]
end
in Eq(34, f (N.mk ~say:(fun x -> x + 2)
)))
in
Eq(34, f_js (N.mk ~say:(fun %uncurry x -> x + 2))))
]

;; Mt.from_pair_suites __FILE__ suites
7 changes: 6 additions & 1 deletion lib/js/test/js_obj_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ function f(u) {
return Curry.js2(5740587, 1, u, 32);
}

function f_js(u) {
return u.say(32);
}

var class_tables = [
0,
0,
Expand Down Expand Up @@ -44,7 +48,7 @@ var suites_001 = /* :: */[
function () {
return /* Eq */Block.__(0, [
34,
f({
f_js({
"say": function (x) {
return x + 2 | 0;
}
Expand All @@ -63,5 +67,6 @@ var suites = /* :: */[
Mt.from_pair_suites("js_obj_test.ml", suites);

exports.f = f;
exports.f_js = f_js;
exports.suites = suites;
/* Not a pure module */

0 comments on commit ef1111e

Please sign in to comment.