(t *testing.T)
| 295 | } |
| 296 | |
| 297 | func TestPanicInHostFunctionDuringCallWithCaller(t *testing.T) { |
| 298 | engine := NewEngine() |
| 299 | linker := NewLinker(engine) |
| 300 | store := NewStore(engine) |
| 301 | err := linker.FuncWrap("foo", "bar", func(c *Caller) int32 { |
| 302 | panic("hi") |
| 303 | }) |
| 304 | require.NoError(t, err) |
| 305 | |
| 306 | wasm, err := Wat2Wasm(` |
| 307 | (module |
| 308 | (import "foo" "bar" (func (result i32))) |
| 309 | (func (export "foo") call 0 drop) |
| 310 | ) |
| 311 | `) |
| 312 | require.NoError(t, err) |
| 313 | |
| 314 | module, err := NewModule(engine, wasm) |
| 315 | require.NoError(t, err) |
| 316 | instance, err := linker.Instantiate(store, module) |
| 317 | require.NoError(t, err) |
| 318 | foo := instance.GetFunc(store, "foo") |
| 319 | require.NotNil(t, foo) |
| 320 | require.PanicsWithValue(t, "hi", func() { |
| 321 | foo.Call(store) |
| 322 | }) |
| 323 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…