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

Function TestFuncCall

func_test.go:17–30  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15}
16
17func TestFuncCall(t *testing.T) {
18 store := NewStore(NewEngine())
19 defer store.Close()
20 called := false
21 cb := func(caller *Caller, args []Val) ([]Val, *Trap) {
22 called = true
23 return []Val{}, nil
24 }
25 f := NewFunc(store, NewFuncType([]*ValType{}, []*ValType{}), cb)
26 results, trap := f.Call(store)
27 require.Nil(t, trap)
28 require.Nil(t, results)
29 require.True(t, called, "didn't call")
30}
31
32func TestFuncTrap(t *testing.T) {
33 store := NewStore(NewEngine())

Callers

nothing calls this directly

Calls 6

CloseMethod · 0.95
CallMethod · 0.95
NewStoreFunction · 0.85
NewEngineFunction · 0.85
NewFuncFunction · 0.85
NewFuncTypeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…