Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/dune_rules/inline_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -362,18 +362,19 @@ include Sub_system.Register_end_point (struct
|> Action_builder.with_stdout_to partition_file
|> Super_context.add_rule sctx ~dir ~loc
in
let* runtest_alias =
match mode with
| Native | Best | Byte -> Memo.return Alias0.runtest
| Jsoo mode -> Jsoo_rules.js_of_ocaml_runtest_alias ~dir ~mode
in
let alias =
"runtest-" ^ Lib_name.Local.to_string lib_name
[ Alias.Name.to_string runtest_alias; Lib_name.Local.to_string lib_name ]
|> String.concat ~sep:"-"
|> Alias.Name.of_string
|> Alias.make ~dir
in
let* () =
let* runtest_alias =
(match mode with
| Native | Best | Byte -> Memo.return Alias0.runtest
| Jsoo mode -> Jsoo_rules.js_of_ocaml_runtest_alias ~dir ~mode)
>>| Alias.make ~dir
in
let runtest_alias = Alias.make ~dir runtest_alias in
Dep.alias alias
|> Action_builder.dep
|> Rules.Produce.Alias.add_deps runtest_alias ~loc
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(library
(name inline_tests_js_alias)
(inline_tests (modes byte js) (backend fake_backend)))

(env
(_
(js_of_ocaml
(runtest_alias runtest-js))))
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
let _ =
Printf.eprintf
"inline tests (%s - alias)\n"
(match Sys.backend_type with
| Native -> "Native"
| Bytecode -> "Byte"
| Other _ -> "JS")
;;
9 changes: 8 additions & 1 deletion test/blackbox-tests/test-cases/jsoo/inline-tests.t/run.t
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
Run inline tests using node js

$ cat >dune-project <<EOF
> (lang dune 2.6)
> (lang dune 3.0)
> EOF

(With the dev profile on OCaml 5, the warning is expected)

$ dune runtest
inline tests (Byte)
inline tests (Byte)
inline tests (Byte - alias)
inline tests (Byte - alias)
inline tests (Native)
inline tests (Native)
Warning [missing-effects-backend]: your program contains effect handlers; you should probably run js_of_ocaml with option '--effects=cps'
Expand All @@ -28,3 +30,8 @@ CR-Alizter: This test has a different behaviour for the macos-latest in the CI a
Error: Don't know how to build
js/.inline_tests_js.inline-tests/inline_test_runner_inline_tests_js.bc
[1]

$ dune build @runtest-js
Warning [missing-effects-backend]: your program contains effect handlers; you should probably run js_of_ocaml with option '--effects=cps'
inline tests (JS - alias)
inline tests (JS - alias)
Loading