-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
87 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// PKGPATH: gno.land/r/crossrealm_test | ||
package crossrealm_test | ||
|
||
import ( | ||
"std" | ||
"fmt" | ||
|
||
psubtests "gno.land/p/demo/tests/subtests" | ||
rsubtests "gno.land/r/demo/tests/subtests" | ||
) | ||
|
||
func main() { | ||
tests := []struct{ | ||
fn func() std.Realm | ||
}{ | ||
{ std.CurrentRealm }, | ||
{ psubtests.GetCurrentRealm }, | ||
{ rsubtests.GetCurrentRealm }, | ||
} | ||
|
||
for _, test := range tests { | ||
r := test.fn() | ||
|
||
if std.DerivePkgAddr(r.PkgPath()) != r.Addr() { | ||
panic(fmt.Sprintf("ERROR: expected: %v, got: %v", | ||
std.DerivePkgAddr(r.PkgPath()), r.Addr(), | ||
)) | ||
} | ||
|
||
println(r.PkgPath(), r.Addr()) | ||
} | ||
} | ||
|
||
// Output: | ||
// gno.land/r/crossrealm_test g1vla5mffzum6060t99u4xhm8mnhgxr0sz4k574p | ||
// gno.land/r/crossrealm_test g1vla5mffzum6060t99u4xhm8mnhgxr0sz4k574p | ||
// gno.land/r/demo/tests/subtests g13g48xnr7lzxsrvny0uf6lhx0cfaxy4n0n5geuf |