Skip to content

Commit

Permalink
TestWebAssembly: use wasm-unknown for panic=trap test
Browse files Browse the repository at this point in the history
  • Loading branch information
dgryski committed Sep 29, 2024
1 parent a47c0c1 commit 10872fc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,20 +470,21 @@ func TestWebAssembly(t *testing.T) {
t.Parallel()
type testCase struct {
name string
target string
panicStrategy string
imports []string
}
for _, tc := range []testCase{
// Test whether there really are no imports when using -panic=trap. This
// tests the bugfix for https://github.com/tinygo-org/tinygo/issues/4161.
{name: "panic-default", imports: []string{"wasi_snapshot_preview1.fd_write"}},
{name: "panic-trap", panicStrategy: "trap", imports: []string{}},
{name: "panic-default", target: "wasip1", imports: []string{"wasi_snapshot_preview1.fd_write", "wasi_snapshot_preview1.clock_time_get"}},
{name: "panic-trap", target: "wasm-unknown", panicStrategy: "trap", imports: []string{}},
} {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
tmpdir := t.TempDir()
options := optionsFromTarget("wasi", sema)
options := optionsFromTarget(tc.target, sema)
options.PanicStrategy = tc.panicStrategy
config, err := builder.NewConfig(&options)
if err != nil {
Expand Down

0 comments on commit 10872fc

Please sign in to comment.