1package vm23import (4 "testing"5)67func TestNestedPkg(cur realm, t *testing.T) {8 // direct child9 curPath := "gno.land/r/tests/vm/foo"10 testing.SetRealm(testing.NewCodeRealm(curPath))11 if !IsCallerSubPath(cross(cur)) {12 t.Errorf(curPath + " should be a sub path")13 }14 if IsCallerParentPath(cross(cur)) {15 t.Errorf(curPath + " should not be a parent path")16 }17 if !HasCallerSameNamespace(cross(cur)) {18 t.Errorf(curPath + " should be from the same namespace")19 }2021 // grand-grand-child22 curPath = "gno.land/r/tests/vm/foo/bar/baz"23 testing.SetRealm(testing.NewCodeRealm(curPath))24 if !IsCallerSubPath(cross(cur)) {25 t.Errorf(curPath + " should be a sub path")26 }27 if IsCallerParentPath(cross(cur)) {28 t.Errorf(curPath + " should not be a parent path")29 }30 if !HasCallerSameNamespace(cross(cur)) {31 t.Errorf(curPath + " should be from the same namespace")32 }3334 // NOTE: This is now back in the gno.land/r/tests/vm structure,35 // so the direct parent test case is valid again.3637 // direct parent (was previously fake parent)38 curPath = "gno.land/r/test" // without the 's' at the end39 testing.SetRealm(testing.NewCodeRealm(curPath))40 if IsCallerSubPath(cross(cur)) {41 t.Errorf(curPath + " should not be a sub path")42 }43 if IsCallerParentPath(cross(cur)) {44 t.Errorf(curPath + " should not be a parent path")45 }46 if HasCallerSameNamespace(cross(cur)) {47 t.Errorf(curPath + " should not be from the same namespace")48 }4950 // fake parent (prefix)51 curPath = "gno.land/r/dem"52 testing.SetRealm(testing.NewCodeRealm(curPath))53 if IsCallerSubPath(cross(cur)) {54 t.Errorf(curPath + " should not be a sub path")55 }56 if IsCallerParentPath(cross(cur)) {57 t.Errorf(curPath + " should not be a parent path")58 }59 if HasCallerSameNamespace(cross(cur)) {60 t.Errorf(curPath + " should not be from the same namespace")61 }6263 // different namespace64 curPath = "gno.land/r/foo"65 testing.SetRealm(testing.NewCodeRealm(curPath))66 if IsCallerSubPath(cross(cur)) {67 t.Errorf(curPath + " should not be a sub path")68 }69 if IsCallerParentPath(cross(cur)) {70 t.Errorf(curPath + " should not be a parent path")71 }72 if HasCallerSameNamespace(cross(cur)) {73 t.Errorf(curPath + " should not be from the same namespace")74 }75}76AbsAdd(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}) []gno.land/r/tests/vm.Word
AddStringer(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, str interface {String func() string})
BankerOriginSend(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}) string
CallAssertOriginCall(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string})
CallIsOriginCall(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}) bool
CallSubtestsAssertOriginCall(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string})
CallSubtestsIsOriginCall(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}) bool
Counter(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}) int
CurrentRealmPath(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}) string
Exec(fn func())
ExecRlm(int, rlm interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, fn func(int, .uverse.realm))
ExecSwitch(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, fn func())
ExecSwitchRlm(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, fn func(int, .uverse.realm))
GetAbs(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}) []gno.land/r/tests/vm.Word
GetPreviousRealm(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}) struct{addr .uverse.address; pkgPath string}
GetRSubtestsPreviousRealm(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}) struct{addr .uverse.address; pkgPath string}
GetZeroType() []gno.land/r/tests/vm.Word
HasCallerSameNamespace(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}) bool
IncCounter(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string})
InitOriginCaller(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}) string
InitTestNodes(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string})
IsCallerParentPath(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}) bool
IsCallerSubPath(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}) bool
ModifyTestRealmObject(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, t *gno.land/r/tests/vm.TestRealmObject)
ModTestNodes(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string})
NewTestRealmObject() *gno.land/r/tests/vm.TestRealmObject
PrintTestNodes()
Render(path string) string
RTestsOriginSend(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}) string
Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.
vm/qrender output, sanitized (docs/render-security.md) and displayed in an empty-sandbox iframe — scripts, forms and popups cannot run. Links stay inert in-preview; right-click to open.