Skip to content

Commit

Permalink
Merge pull request #403 from hhugo/fix-for-new-jsoo
Browse files Browse the repository at this point in the history
Adapt jsoo runtime to new jsoo version
  • Loading branch information
dinosaure authored Jun 4, 2024
2 parents c2b42cb + 850e906 commit c62a108
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
1 change: 1 addition & 0 deletions alcotest.opam
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ depends: [
]
conflicts: [
"result" {< "1.5"}
"js_of_ocaml-compiler" {< "5.8"}
]
build: [
["dune" "subst"] {dev}
Expand Down
1 change: 1 addition & 0 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ tests to run.
ocaml-syntax-shims)
(conflicts
(result (< 1.5)) ;; Ensure `Result.result` = `Stdlib.result` when possible
(js_of_ocaml-compiler (< 5.8)) ;; requirement for the js stubs
))

(package
Expand Down
17 changes: 7 additions & 10 deletions src/alcotest/runtime.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
//Provides: alcotest_saved_stdout
var alcotest_saved_stdout
var alcotest_saved_stdout
//Provides: alcotest_saved_stderr
var alcotest_saved_stderr

//Provides: alcotest_before_test
//Requires: caml_global_data, caml_ml_channels
//Requires: caml_ml_channel_redirect
//Requires: alcotest_saved_stderr, alcotest_saved_stdout
function alcotest_before_test (voutput, vstdout, vstderr){
alcotest_saved_stderr = caml_ml_channels[vstderr];
alcotest_saved_stdout = caml_ml_channels[vstdout];
var output = caml_ml_channels[voutput];
caml_ml_channels[vstdout] = output;
caml_ml_channels[vstderr] = output;
alcotest_saved_stderr = caml_ml_channel_redirect(vstderr,voutput);
alcotest_saved_stdout = caml_ml_channel_redirect(vstdout,voutput);
return 0;
}

//Provides: alcotest_after_test
//Requires: caml_global_data, caml_ml_channels
//Requires: caml_ml_channel_restore
//Requires: alcotest_saved_stderr, alcotest_saved_stdout
function alcotest_after_test (vstdout, vstderr){
caml_ml_channels[vstdout] = alcotest_saved_stdout;
caml_ml_channels[vstderr] = alcotest_saved_stderr;
caml_ml_channel_restore(vstdout, alcotest_saved_stdout);
caml_ml_channel_restore(vstderr, alcotest_saved_stderr);
return 0;
}

Expand Down

0 comments on commit c62a108

Please sign in to comment.