Skip to content

Commit

Permalink
investigate
Browse files Browse the repository at this point in the history
  • Loading branch information
hhugo committed Aug 4, 2023
1 parent e4c3ad6 commit 6af0de7
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions lib/tests/test_fun_call.ml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ let%expect_test "wrap_callback_strict" =
(Js.Unsafe.callback_with_arity 2 cb3)
{| (function(f){ return f(1,2,3) }) |};
[%expect {|
Result: function#1#1 |}];
Result: function#1#undefined |}];
call_and_log
(Js.Unsafe.callback_with_arity 2 cb3)
~cont:(fun g -> g 4)
Expand All @@ -164,7 +164,7 @@ let%expect_test "wrap_callback_strict" =
Result: 0 |}];
call_and_log (Js.Unsafe.callback_with_arity 2 cb3) {| (function(f){ return f(1,2) }) |};
[%expect {|
Result: function#1#1 |}]
Result: function#1#undefined |}]

let%expect_test "wrap_callback_strict" =
call_and_log
Expand Down Expand Up @@ -291,7 +291,7 @@ let%expect_test "wrap_meth_callback_strict" =
(Js.Unsafe.meth_callback_with_arity 2 cb4)
{| (function(f){ return f.apply("this",[1,2,3]) }) |};
[%expect {|
Result: function#1#1 |}];
Result: function#1#undefined |}];
call_and_log
(Js.Unsafe.meth_callback_with_arity 2 cb4)
~cont:(fun g -> g 4)
Expand All @@ -309,7 +309,7 @@ let%expect_test "wrap_meth_callback_strict" =
call_and_log
(Js.Unsafe.meth_callback_with_arity 2 cb4)
{| (function(f){ return f.apply("this",[1,2]) }) |};
[%expect {| Result: function#1#1 |}]
[%expect {| Result: function#1#undefined |}]

let%expect_test "wrap_meth_callback_strict" =
call_and_log
Expand Down Expand Up @@ -338,23 +338,21 @@ let%expect_test "over application, extra arguments are dropped" =
(Js.Unsafe.meth_callback cb4)
{| (function(f){ return f.apply("this",[1,2,3,4]) }) |};
[%expect {|
got this, 1, 2, 3, done
Result: 0 |}]
Result: function#1#undefined |}]

let%expect_test "partial application, extra arguments set to undefined" =
call_and_log
(Js.Unsafe.meth_callback cb4)
{| (function(f){ return f.apply("this",[1,2]) }) |};
[%expect {|
got this, 1, 2, undefined, done
Result: 0 |}]
Result: function#1#undefined |}]

(* caml_call_gen *)

let%expect_test _ =
call_and_log cb3 ~cont:(fun g -> g 1) {| (function(f){ return f }) |};
[%expect {|
Result: function#2#2 |}]
Result: function#1#undefined |}]

let%expect_test _ =
call_and_log cb3 ~cont:(fun g -> g 1 2 3 4) {| (function(f){ return f }) |};
Expand All @@ -369,7 +367,7 @@ let%expect_test _ =
| _ -> Printf.printf "Error: unknown"
in
f cb5;
[%expect {| Result: function#1#1 |}];
[%expect {| Result: function#1#undefined |}];
f cb4;
[%expect {|
got 1, 1, 2, 3, done
Expand Down Expand Up @@ -399,10 +397,10 @@ let%expect_test _ =
Result: 0 |}];
f (Obj.magic cb4);
[%expect {|
Result: function#1#1 |}];
Result: function#1#undefined |}];
f (Obj.magic cb5);
[%expect {|
Result: function#2#2 |}]
Result: function#1#undefined |}]

let%expect_test _ =
let open Js_of_ocaml in
Expand Down

0 comments on commit 6af0de7

Please sign in to comment.