MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime-go / TestInstanceBad

Function TestInstanceBad

instance_test.go:53–70  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

51}
52
53func TestInstanceBad(t *testing.T) {
54 store := NewStore(NewEngine())
55 wasm, err := Wat2Wasm(`(module (import "" "" (func)))`)
56 require.NoError(t, err)
57 module, err := NewModule(NewEngine(), wasm)
58 require.NoError(t, err)
59
60 // wrong number of imports
61 instance, err := NewInstance(store, module, []AsExtern{})
62 require.Nil(t, instance)
63 require.Error(t, err)
64
65 // wrong types of imports
66 f := WrapFunc(store, func(a int32) {})
67 instance, err = NewInstance(store, module, []AsExtern{f})
68 require.Nil(t, instance)
69 require.Error(t, err)
70}
71
72func TestInstanceGetFunc(t *testing.T) {
73 wasm, err := Wat2Wasm(`

Callers

nothing calls this directly

Calls 7

NewStoreFunction · 0.85
NewEngineFunction · 0.85
Wat2WasmFunction · 0.85
NewModuleFunction · 0.85
NewInstanceFunction · 0.85
WrapFuncFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…