Skip to content

Commit

Permalink
Add wasmer config SetTestVersion method
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 committed Sep 15, 2022
1 parent a1e127b commit 5c2a09a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/runtime/wasmer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package wasmer

import (
"testing"

"github.com/ChainSafe/gossamer/internal/log"
"github.com/ChainSafe/gossamer/lib/common"
"github.com/ChainSafe/gossamer/lib/keystore"
Expand All @@ -23,3 +25,14 @@ type Config struct {
CodeHash common.Hash
testVersion *runtime.Version
}

// SetTestVersion sets the test version for the runtime.
// WARNING: This should only be used for testing purposes.
// The *testing.T argument is only required to enforce this function
// to be used in tests only.
func (c *Config) SetTestVersion(t *testing.T, version runtime.Version) {
if t == nil {
panic("*testing.T argument cannot be nil. Please don't use this function outside of Go tests.")
}
c.testVersion = &version
}

0 comments on commit 5c2a09a

Please sign in to comment.