Skip to content

Commit 9ad1fcc

Browse files
committed
CR: move new tests to tests-jsoo/lib-effects
1 parent 227f261 commit 9ad1fcc

File tree

7 files changed

+78
-55
lines changed

7 files changed

+78
-55
lines changed

compiler/tests-ocaml/lib-effects/assume_no_perform_nested_handler.ml renamed to compiler/tests-jsoo/lib-effects/assume_no_perform_nested_handler.ml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,16 @@ let () =
88
try_with
99
(fun () ->
1010
Js_of_ocaml.Effect_js.assume_no_perform (fun () ->
11-
try_with
12-
(fun () -> ())
13-
()
14-
{ effc = (fun (type a) (_ : a Effect.t) -> None) };
15-
);
16-
perform Dummy
17-
)
11+
try_with (fun () -> ()) () { effc = (fun (type a) (_ : a Effect.t) -> None) });
12+
perform Dummy)
1813
()
1914
{ effc =
2015
(fun (type a) (e : a Effect.t) ->
2116
match e with
2217
| Dummy ->
23-
Some (fun (k : (a, _) continuation) -> print_endline "ok"; continue k ())
18+
Some
19+
(fun (k : (a, _) continuation) ->
20+
print_endline "ok";
21+
continue k ())
2422
| _ -> None)
2523
}

compiler/tests-ocaml/lib-effects/assume_no_perform_unhandled.ml renamed to compiler/tests-jsoo/lib-effects/assume_no_perform_unhandled.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ let must_raise () =
88
try_with
99
(fun () ->
1010
Js_of_ocaml.Effect_js.assume_no_perform (fun () ->
11-
(* Should raise [Effect.Unhandled] despite the installed handler *)
12-
perform Dummy
13-
)
14-
)
11+
(* Should raise [Effect.Unhandled] despite the installed handler *)
12+
perform Dummy))
1513
()
1614
{ effc =
1715
(fun (type a) (e : a Effect.t) ->
@@ -22,5 +20,7 @@ let must_raise () =
2220

2321
let () =
2422
try
25-
must_raise (); print_endline "failed"; exit 2
23+
must_raise ();
24+
print_endline "failed";
25+
exit 2
2626
with Effect.Unhandled Dummy -> print_endline "ok"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
(env
2+
(with-effects
3+
(flags
4+
(:standard -w -38))
5+
(js_of_ocaml
6+
(flags
7+
(:standard --effects=double-translation))
8+
;; separate compilation doesn't yet work when using
9+
;; '--effect=double-translation' since Dune doesn't know it should compile a
10+
;; different version of the dependencies.
11+
;; TODO: remove once support in ocaml/dune#11222 is released.
12+
(compilation_mode whole_program)))
13+
(_
14+
(flags
15+
(:standard -w -38))
16+
(js_of_ocaml
17+
(flags
18+
(:standard --effects=double-translation))
19+
;; separate compilation doesn't yet work when using
20+
;; '--effect=double-translation' since Dune doesn't know it should compile a
21+
;; different version of the dependencies.
22+
;; TODO: remove once support in ocaml/dune#11222 is released.
23+
(compilation_mode whole_program))))
24+
25+
(copy_files# ../*.ml)
26+
27+
(tests
28+
(build_if
29+
(>= %{ocaml_version} 5))
30+
(names
31+
assume_no_perform
32+
assume_no_perform_unhandled
33+
assume_no_perform_nested_handler)
34+
(libraries js_of_ocaml)
35+
(action
36+
(ignore-outputs
37+
(with-accepted-exit-codes
38+
0
39+
(run node %{test}))))
40+
(modes js))

compiler/tests-jsoo/lib-effects/dune

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,30 @@
1010
(>= %{ocaml_version} 5))
1111
(inline_tests
1212
(modes js wasm best))
13+
(modules
14+
(:standard
15+
\
16+
assume_no_perform
17+
assume_no_perform_unhandled
18+
assume_no_perform_nested_handler))
1319
(preprocess
1420
(pps ppx_expect)))
21+
22+
(tests
23+
(build_if
24+
(>= %{ocaml_version} 5))
25+
(names
26+
assume_no_perform
27+
assume_no_perform_unhandled
28+
assume_no_perform_nested_handler)
29+
(modules
30+
assume_no_perform
31+
assume_no_perform_unhandled
32+
assume_no_perform_nested_handler)
33+
(libraries js_of_ocaml)
34+
(action
35+
(ignore-outputs
36+
(with-accepted-exit-codes
37+
0
38+
(run node %{test}))))
39+
(modes js wasm))

compiler/tests-ocaml/lib-effects/double-translation/dune

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,7 @@
5252
test_lazy
5353
used_cont)
5454
(modules
55-
(:standard
56-
\
57-
unhandled_unlinked
58-
assume_no_perform
59-
assume_no_perform_unhandled
60-
assume_no_perform_nested_handler))
55+
(:standard \ unhandled_unlinked))
6156
(modes js))
6257

6358
(tests
@@ -72,18 +67,3 @@
7267
(run node %{test}))
7368
(run cat)))
7469
(modes js))
75-
76-
(tests
77-
(build_if
78-
(>= %{ocaml_version} 5))
79-
(names
80-
assume_no_perform
81-
assume_no_perform_unhandled
82-
assume_no_perform_nested_handler)
83-
(libraries js_of_ocaml)
84-
(action
85-
(ignore-outputs
86-
(with-accepted-exit-codes
87-
0
88-
(run node %{test}))))
89-
(modes js))

compiler/tests-ocaml/lib-effects/dune

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,7 @@
3434
test_lazy
3535
used_cont)
3636
(modules
37-
(:standard
38-
\
39-
unhandled_unlinked
40-
assume_no_perform
41-
assume_no_perform_unhandled
42-
assume_no_perform_nested_handler))
37+
(:standard \ unhandled_unlinked))
4338
(modes js wasm))
4439

4540
(tests
@@ -54,18 +49,3 @@
5449
(run node %{test}))
5550
(run cat)))
5651
(modes js wasm))
57-
58-
(tests
59-
(build_if
60-
(>= %{ocaml_version} 5))
61-
(names
62-
assume_no_perform
63-
assume_no_perform_unhandled
64-
assume_no_perform_nested_handler)
65-
(libraries js_of_ocaml)
66-
(action
67-
(ignore-outputs
68-
(with-accepted-exit-codes
69-
0
70-
(run node %{test}))))
71-
(modes js wasm))

0 commit comments

Comments
 (0)