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

Function TestLinkerShadowing

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

Source from the content-addressed store, hash-verified

51}
52
53func TestLinkerShadowing(t *testing.T) {
54 store := NewStore(NewEngine())
55 linker := NewLinker(store.Engine)
56 require.NoError(t, linker.Define(store, "", "f", WrapFunc(store, func() {})))
57 err := linker.Define(store, "", "f", WrapFunc(store, func() {}))
58 require.Error(t, err)
59
60 linker.AllowShadowing(true)
61 require.NoError(t, linker.Define(store, "", "f", WrapFunc(store, func() {})))
62 linker.AllowShadowing(false)
63 err = linker.Define(store, "", "f", WrapFunc(store, func() {}))
64 require.Error(t, err)
65}
66
67func TestLinkerTrap(t *testing.T) {
68 store := NewStore(NewEngine())

Callers

nothing calls this directly

Calls 7

DefineMethod · 0.95
AllowShadowingMethod · 0.95
NewStoreFunction · 0.85
NewEngineFunction · 0.85
NewLinkerFunction · 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…