Skip to content

Commit aa96a3d

Browse files
committed
update _start test
1 parent 909d159 commit aa96a3d

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

compiler/test/suites/provides.re

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,25 @@ describe("provides", ({test, testSkip}) => {
66
Sys.backend_type == Other("js_of_ocaml") ? testSkip : test;
77

88
let assertSnapshot = makeSnapshotRunner(test);
9-
let assertStartSectionSnapshot =
10-
makeSnapshotRunner(
11-
~config_fn=() => {Grain_utils.Config.use_start_section := true},
12-
test,
13-
);
149
let assertCompileError = makeCompileErrorRunner(test);
1510
let assertRun = makeRunner(test_or_skip);
1611
let assertFileRun = makeFileRunner(test_or_skip);
1712
let assertRunError = makeErrorRunner(test_or_skip);
18-
let assertHasWasmExport = (name, prog, expectedExports) => {
13+
let assertHasWasmExport =
14+
(~use_start_section=false, name, prog, expectedExports) => {
1915
test(
2016
name,
2117
({expect}) => {
2218
let state =
23-
compile(~hook=Grain.Compile.stop_after_compiled, name, prog);
19+
compile(
20+
~hook=Grain.Compile.stop_after_compiled,
21+
~config_fn=
22+
() => {
23+
Grain_utils.Config.use_start_section := use_start_section
24+
},
25+
name,
26+
prog,
27+
);
2428
();
2529
switch (state.Grain.Compile.cstate_desc) {
2630
| Compiled({asm}) =>
@@ -198,14 +202,17 @@ describe("provides", ({test, testSkip}) => {
198202

199203
assertSnapshot("let_rec_provide", "provide let rec foo = () => 5");
200204

201-
assertStartSectionSnapshot(
205+
assertHasWasmExport(
206+
~use_start_section=true,
202207
"provide_start_function",
203208
{|
209+
module Start
204210
print("init")
205211
provide let _start = () => {
206212
print("starting up")
207213
}
208214
|},
215+
[("_start", Binaryen.Export.external_function)],
209216
);
210217

211218
assertHasWasmExport(

0 commit comments

Comments
 (0)