id |
---|
testing |
func TestSkipHeights(count int64)
func TestSetOrigCaller(addr Address)
func TestSetOrigPkgAddr(addr Address)
func TestSetOrigSend(sent, spent Coins)
func TestIssueCoins(addr Address, coins Coins)
func TestSetRealm(realm Realm)
func NewUserRealm(address Address) Realm
func NewCodeRealm(pkgPath string) Realm
func TestSkipHeights(count int64)
Modifies the block height variable by skipping count blocks.
It also increases block timestamp by 5 seconds for every single count
std.TestSkipHeights(100)
func TestSetOrigCaller(addr Address)
Sets the current caller of the transaction to addr.
std.TestSetOrigCaller(std.Address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5"))
func TestSetOrigPkgAddr(addr Address)
Sets the call entry realm address to addr.
std.TestSetOrigPkgAddr(std.Address("g1ecely4gjy0yl6s9kt409ll330q9hk2lj9ls3ec"))
func TestSetOrigSend(sent, spent Coins)
Sets the sent & spent coins for the current context.
std.TestSetOrigSend(sent, spent Coins)
func TestIssueCoins(addr Address, coins Coins)
Issues testing context coins to addr.
issue := std.Coins{{"coin1", 100}, {"coin2", 200}}
addr := std.Address("g1ecely4gjy0yl6s9kt409ll330q9hk2lj9ls3ec")
std.TestIssueCoins(addr, issue)
func TestSetRealm(rlm Realm)
Sets the realm for the current frame. After calling TestSetRealm()
, calling
CurrentRealm()
in the same test function will yield the value of rlm
, and
any PrevRealm()
called from a function used after TestSetRealm will yield rlm
.
Should be used in combination with NewUserRealm
&
NewCodeRealm
.
addr := std.Address("g1ecely4gjy0yl6s9kt409ll330q9hk2lj9ls3ec")
std.TestSetRealm(std.NewUserRealm(""))
// or
std.TestSetRealm(std.NewCodeRealm("gno.land/r/demo/users"))
func NewUserRealm(address Address) Realm
Creates a new user realm for testing purposes.
addr := std.Address("g1ecely4gjy0yl6s9kt409ll330q9hk2lj9ls3ec")
userRealm := std.NewUserRealm(addr)
func NewCodeRealm(pkgPath string) Realm
Creates a new code realm for testing purposes.
path := "gno.land/r/demo/boards"
codeRealm := std.NewCodeRealm(path)