Skip to content
Merged
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
11 changes: 9 additions & 2 deletions dev/wasmstdlib/hostcheck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,15 @@ func TestFullChildCommandProfiles(t *testing.T) {
if !slices.Contains(cmd.Args, "node") || !strings.Contains(joined, "emscripten") {
t.Fatalf("%s missing JS runner: %+v", name, cmd)
}
if got := slices.Contains(cmd.Args, "--browser-only"); got != (p.Target == "") {
t.Fatalf("%s browser loader selection = %v: %+v", name, got, cmd)
want := []string{"--kill-after=10s", "30s", "node", filepath.Join("/repo", "targets", "emscripten-runner.mjs")}
if name == "J32-GoJS" {
want = append(want, "--browser-only")
} else if name == "J64-Emscripten" {
want[3] = filepath.Join("/repo", "targets", "emscripten-memory64-runner.mjs")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor maintainability nit (non-blocking): want[3] mutates a positional slot whose correctness silently depends on the fixed timeout prefix length (--kill-after=10s, 30s, node, <runner>) built in fullChildCommand. The literal 3 is a magic index — if that prefix ever changes, this would substitute the wrong element rather than fail loudly. Consider locating the runner slot by searching for the .mjs entry (or building want per-profile from a shared base) so the assertion documents intent. Current value is correct.

}
want = append(want, "/compiled-test", "-llgo.caller-panic-child")
if !slices.Equal(cmd.Args, want) {
t.Fatalf("%s child command = %v, want %v", name, cmd.Args, want)
}
}
}
Expand Down
Loading