MCPcopy
hub / github.com/tinygo-org/tinygo / TestWasmExport

Function TestWasmExport

main_test.go:579–771  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

577}
578
579func TestWasmExport(t *testing.T) {
580 t.Parallel()
581
582 type testCase struct {
583 name string
584 target string
585 buildMode string
586 scheduler string
587 file string
588 noOutput bool
589 command bool // call _start (command mode) instead of _initialize
590 }
591
592 tests := []testCase{
593 // "command mode" WASI
594 {
595 name: "WASIp1-command",
596 target: "wasip1",
597 command: true,
598 },
599 // "reactor mode" WASI (with -buildmode=c-shared)
600 {
601 name: "WASIp1-reactor",
602 target: "wasip1",
603 buildMode: "c-shared",
604 },
605 // Make sure reactor mode also works without a scheduler.
606 {
607 name: "WASIp1-reactor-noscheduler",
608 target: "wasip1",
609 buildMode: "c-shared",
610 scheduler: "none",
611 file: "wasmexport-noscheduler.go",
612 },
613 // Test -target=wasm-unknown with the default build mode (which is
614 // c-shared).
615 {
616 name: "wasm-unknown-reactor",
617 target: "wasm-unknown",
618 file: "wasmexport-noscheduler.go",
619 noOutput: true, // wasm-unknown cannot produce output
620 },
621 // Test -target=wasm-unknown with -buildmode=default, which makes it run
622 // in command mode.
623 {
624 name: "wasm-unknown-command",
625 target: "wasm-unknown",
626 buildMode: "default",
627 file: "wasmexport-noscheduler.go",
628 noOutput: true, // wasm-unknown cannot produce output
629 command: true,
630 },
631 // Test buildmode=wasi-legacy with WASI.
632 {
633 name: "WASIp1-legacy",
634 target: "wasip1",
635 buildMode: "wasi-legacy",
636 scheduler: "none",

Callers

nothing calls this directly

Calls 13

optionsFromTargetFunction · 0.85
checkOutputFunction · 0.85
ParallelMethod · 0.80
ExitCodeMethod · 0.80
TempDirMethod · 0.65
FatalMethod · 0.65
CloseMethod · 0.65
ErrorMethod · 0.65
ErrorfMethod · 0.65
runTestsFunction · 0.50
RunMethod · 0.45
CallMethod · 0.45

Tested by

no test coverage detected