Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

z3_filetest.gno

0.78 Kb · 30 lines
 1// PKGPATH: gno.land/r/tests_z3
 2package tests_z3
 3
 4import (
 5	"chain"
 6	"testing"
 7
 8	"gno.land/p/nt/testutils/v0"
 9	"gno.land/r/tests/vm"
10)
11
12func main(cur realm) {
13	var (
14		eoa        = testutils.TestAddress("someone")
15		rTestsAddr = chain.PackageAddress("gno.land/r/tests/vm")
16	)
17	testing.SetOriginCaller(eoa)
18	// Contrarily to z2_filetest.gno we EXPECT GetPreviousRealms != eoa (#1704)
19	if addr := vm.GetPreviousRealm(cross(cur)).Address(); addr != eoa {
20		println("want vm.GetPreviousRealm().Address ==", eoa, "got", addr)
21	}
22	// When 2 or more realms in the frames, it is also different
23	if addr := vm.GetRSubtestsPreviousRealm(cross(cur)).Address(); addr != rTestsAddr {
24		println("want GetRSubtestsPreviousRealm().Address ==", rTestsAddr, "got", addr)
25	}
26	println("Done.")
27}
28
29// Output:
30// Done.