Skip to content

Commit

Permalink
Fix problem with store initialization and add more tests
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
  • Loading branch information
ajnavarro committed Aug 3, 2023
1 parent 1a84ff9 commit 34a2024
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 4 additions & 4 deletions gnovm/pkg/repl/repl.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@ func NewRepl(opts ...ReplOption) *Repl {
r.stdout = &b
r.stderr = &b

for _, o := range opts {
o(r)
}

r.storeFunc = func() gno.Store {
return tests.TestStore("teststore", "", r.stdin, r.stdout, r.stderr, tests.ImportModeStdlibsOnly)
}

for _, o := range opts {
o(r)
}

r.state = newState(r.stdout, r.storeFunc)

br := bufio.NewReader(r.stdin)
Expand Down
5 changes: 5 additions & 0 deletions gnovm/pkg/repl/repl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ func TestReplOpts(t *testing.T) {
require := require.New(t)

r := NewRepl(WithStd(nil, nil, nil), WithStore(nil))
require.Nil(r.storeFunc())
require.Nil(r.stderr)
require.Nil(r.stdin)
require.Nil(r.stdout)

_, err := r.Process("import \"fmt\"")
require.NoError(err)
}
Expand Down

0 comments on commit 34a2024

Please sign in to comment.