(t *testing.T)
| 267 | } |
| 268 | |
| 269 | func TestPanicInHostFunctionDuringCall(t *testing.T) { |
| 270 | engine := NewEngine() |
| 271 | linker := NewLinker(engine) |
| 272 | store := NewStore(engine) |
| 273 | err := linker.FuncWrap("foo", "bar", func() { |
| 274 | panic("hi") |
| 275 | }) |
| 276 | require.NoError(t, err) |
| 277 | |
| 278 | wasm, err := Wat2Wasm(` |
| 279 | (module |
| 280 | (import "foo" "bar" (func)) |
| 281 | (func (export "foo") call 0) |
| 282 | ) |
| 283 | `) |
| 284 | require.NoError(t, err) |
| 285 | |
| 286 | module, err := NewModule(engine, wasm) |
| 287 | require.NoError(t, err) |
| 288 | instance, err := linker.Instantiate(store, module) |
| 289 | require.NoError(t, err) |
| 290 | foo := instance.GetFunc(store, "foo") |
| 291 | require.NotNil(t, foo) |
| 292 | require.PanicsWithValue(t, "hi", func() { |
| 293 | foo.Call(store) |
| 294 | }) |
| 295 | } |
| 296 | |
| 297 | func TestPanicInHostFunctionDuringCallWithCaller(t *testing.T) { |
| 298 | engine := NewEngine() |
nothing calls this directly
no test coverage detected
searching dependent graphs…