(tests
 (names gh38 gh46 gh107 gh112 gh1904 gh2034 int64_of_string)
 (modes js wasm)
 (js_of_ocaml
  (flags :standard --disable optcall --no-inline))
 (wasm_of_ocaml
  (flags :standard --disable optcall --no-inline)))

(tests
 (names fun_eq open_append)
 (modes js wasm))

(tests
 (names marshal_regressions int_and)
 (modes wasm))

(tests
 (names globalize_assign)
 (modes wasm)
 ; With -g, ocamlc does not turn the reference into a mutable variable
 (flags
  (:standard \ -g))
 (ocamlc_flags ())
 (wasm_of_ocaml
  (flags :standard -w no-missing-debug-event)))

(tests
 (names assign)
 (modes js wasm)
 ; With -g, ocamlc does not turn the references into mutable variables
 (flags
  (:standard \ -g))
 (ocamlc_flags ())
 (js_of_ocaml
  (flags :standard -w no-missing-debug-event)
  (link_flags :standard -w no-missing-debug-event))
 (wasm_of_ocaml
  (flags :standard -w no-missing-debug-event)
  (link_flags :standard -w no-missing-debug-event)))

(tests
 (names marshal_fixes)
 (modes js wasm))

(tests
 (names readdir_after_closedir unix_ids)
 (modes wasm)
 (libraries unix))

(tests
 (names jsstring_buffer)
 (modes wasm)
 (libraries compiler-libs.common js_of_ocaml)
 ; Compressed marshalling requires OCaml 5.2 and is not available under OxCaml.
 ; The buffer this exercises is specific to the non-wasi runtime.
 (build_if
  (and
   (>= %{ocaml_version} 5.2)
   (not %{oxcaml_supported})
   (<> %{env:JSOO_TEST_ENGINE=node} wasi))))

(tests
 (names gh2093)
 (modes wasm)
 (enabled_if
  (and
   (>= %{ocaml_version} 5)
   (<> %{profile} wasi)))
 (wasm_of_ocaml
  (compilation_mode whole_program)
  (flags :standard)))

(tests
 (names bigarray_generic)
 (modes wasm)
 ; Generic bigarray accesses are only specialized when the type analysis knows
 ; the kind and layout of the bigarray, which requires whole-program
 ; compilation.
 (wasm_of_ocaml
  (compilation_mode whole_program)
  (flags :standard)))

(tests
 (names bigarray_dim)
 (modes js wasm)
 ; Bigarray accesses are specialized when the type analysis knows the kind
 ; and layout of the bigarray
 (wasm_of_ocaml
  (compilation_mode whole_program)
  (flags :standard --opt 2)))

(tests
 (names string_interning)
 (modes wasm))

(tests
 (names handler_shortcut)
 (modes js wasm)
 ; Without -g, ocamlc turns local references into mutable variables,
 ; which exercises Assign instructions
 (ocamlc_flags ())
 ; Source maps are enabled in dev mode, where they warn about the missing
 ; debug information. (Passing --no-source-map instead would fail in
 ; release mode, where dune passes it already and the option cannot be
 ; repeated.)
 (js_of_ocaml
  (flags :standard -w no-missing-debug-event)
  (link_flags :standard -w no-missing-debug-event))
 (wasm_of_ocaml
  (flags :standard -w no-missing-debug-event)
  (link_flags :standard -w no-missing-debug-event)))

; The programs compiled here run Wasm code and rely on Node's module
; resolution (`require`, `require.main`). QuickJS provides neither, so these
; tests are skipped under the `quickjs` profile.

(cram
 (deps %{bin:wasm_of_ocaml})
 (enabled_if
  (<> %{profile} quickjs)))
