z3_filetest.gno

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