Skip to content

Commit

Permalink
do not assign id to testmain if it's not a realm
Browse files Browse the repository at this point in the history
  • Loading branch information
tbruyelle committed Jun 22, 2023
1 parent ddbab8a commit 336edab
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions gnovm/cmd/gno/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,13 @@ func runTestFiles(
m.RunFiles(files.Files...)
n := gno.MustParseFile("testmain.gno", testmain)
m.RunFiles(n)
// XXX Affect an ID to testmain so it doesn't trigger a panic when
// realm.FinalizeRealmTransaction() is invoked
oo := m.Package.GetFileBlock(m.Store, n.Name)
m.Realm.AssignNewObjectID(oo)

if m.Realm != nil {
// XXX Affect an ID to testmain if it's under a realm, so it doesn't
// trigger a panic when realm.FinalizeRealmTransaction() is invoked.
b := m.Package.GetFileBlock(m.Store, n.Name)
m.Realm.AssignNewObjectID(b)
}

for _, test := range testFuncs.Tests {
if verbose {
Expand Down

0 comments on commit 336edab

Please sign in to comment.