mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-19 12:04:03 +00:00
TestWebAssembly: use wasm-unknown for panic=trap test
This commit is contained in:
+4
-3
@@ -470,20 +470,21 @@ func TestWebAssembly(t *testing.T) {
|
|||||||
t.Parallel()
|
t.Parallel()
|
||||||
type testCase struct {
|
type testCase struct {
|
||||||
name string
|
name string
|
||||||
|
target string
|
||||||
panicStrategy string
|
panicStrategy string
|
||||||
imports []string
|
imports []string
|
||||||
}
|
}
|
||||||
for _, tc := range []testCase{
|
for _, tc := range []testCase{
|
||||||
// Test whether there really are no imports when using -panic=trap. This
|
// Test whether there really are no imports when using -panic=trap. This
|
||||||
// tests the bugfix for https://github.com/tinygo-org/tinygo/issues/4161.
|
// tests the bugfix for https://github.com/tinygo-org/tinygo/issues/4161.
|
||||||
{name: "panic-default", imports: []string{"wasi_snapshot_preview1.fd_write"}},
|
{name: "panic-default", target: "wasip1", imports: []string{"wasi_snapshot_preview1.fd_write", "wasi_snapshot_preview1.random_get"}},
|
||||||
{name: "panic-trap", panicStrategy: "trap", imports: []string{}},
|
{name: "panic-trap", target: "wasm-unknown", panicStrategy: "trap", imports: []string{}},
|
||||||
} {
|
} {
|
||||||
tc := tc
|
tc := tc
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
tmpdir := t.TempDir()
|
tmpdir := t.TempDir()
|
||||||
options := optionsFromTarget("wasi", sema)
|
options := optionsFromTarget(tc.target, sema)
|
||||||
options.PanicStrategy = tc.panicStrategy
|
options.PanicStrategy = tc.panicStrategy
|
||||||
config, err := builder.NewConfig(&options)
|
config, err := builder.NewConfig(&options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user