MCPcopy Create free account
hub / github.com/devld/go-drive / newSharedStateTestVM

Function newSharedStateTestVM

drive/script/shared_state_test.go:12–26  ·  view source on GitHub ↗
(t *testing.T, d *ScriptDrive)

Source from the content-addressed store, hash-verified

10)
11
12func newSharedStateTestVM(t *testing.T, d *ScriptDrive) *s.VM {
13 t.Helper()
14 root, e := s.NewVM()
15 if e != nil {
16 t.Fatal(e)
17 }
18 vm := root.Fork()
19 vm.Set("setData", s.WrapVmCall(vm, d.setData))
20 vm.Set("getData", s.WrapVmCall(vm, d.getData))
21 t.Cleanup(func() {
22 _ = vm.Dispose()
23 _ = root.Dispose()
24 })
25 return vm
26}
27
28func TestSharedStateIsCopiedBetweenVMs(t *testing.T) {
29 d := &ScriptDrive{data: make(map[string]json.RawMessage)}

Calls 4

ForkMethod · 0.95
DisposeMethod · 0.95
DisposeMethod · 0.65
SetMethod · 0.45

Tested by

no test coverage detected