This commit is contained in:
swrup 2025-11-11 02:07:51 +01:00
parent aa2ff7b2f0
commit 2f3113f55d
11742 changed files with 1223940 additions and 0 deletions

View file

@ -0,0 +1,2 @@
let _ = assert (Sys.backend_type = Bytecode)
let _ = print_endline "inline tests (Byte)"

View file

@ -0,0 +1,3 @@
(library
(name inline_tests_byte)
(inline_tests (modes byte) (backend fake_backend)))

View file

@ -0,0 +1,8 @@
(library
(name fake_backend)
(modules ())
(inline_tests.backend
(generate_runner
(progn
(echo "[@@@warning \"-40\"]\n")
(cat %{impl-files})))))

View file

@ -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))))

View file

@ -0,0 +1,8 @@
let _ =
Printf.eprintf
"inline tests (%s - alias)\n"
(match Sys.backend_type with
| Native -> "Native"
| Bytecode -> "Byte"
| Other _ -> "JS")
;;

View file

@ -0,0 +1,4 @@
(library
(name inline_tests_js)
(js_of_ocaml (javascript_files js.js))
(inline_tests (modes js) (backend fake_backend)))

View file

@ -0,0 +1,2 @@
//Provides:jsoo_stubs
function jsoo_stubs() { return 1 }

View file

@ -0,0 +1,6 @@
external prim : unit -> bool = "jsoo_stubs"
let _ = assert (Sys.int_size = 32)
let _ = assert (prim ())
let _ = print_endline "inline tests (JS)"

View file

@ -0,0 +1,3 @@
(library
(name inline_tests_native)
(inline_tests (modes native) (backend fake_backend)))

View file

@ -0,0 +1,2 @@
let _ = assert (Sys.backend_type = Native)
let _ = print_endline "inline tests (Native)"

View file

@ -0,0 +1,37 @@
Run inline tests using node js
$ cat >dune-project <<EOF
> (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'
inline tests (JS)
inline tests (JS)
CR-Alizter: This test has a different behaviour for the macos-latest in the CI and additionally runs the (Byte) tests. This seems unintentional and should be investigated. For now this test is disabled on macos.
$ dune runtest --profile release
Warning [missing-effects-backend]: your program contains effect handlers; you should probably run js_of_ocaml with option '--effects=cps'
inline tests (JS)
inline tests (JS)
inline tests (Native)
inline tests (Native)
$ dune build js/.inline_tests_js.inline-tests/inline_test_runner_inline_tests_js.bc
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)