Skip to content

Commit

Permalink
remove global var from testing
Browse files Browse the repository at this point in the history
  • Loading branch information
tbruyelle committed Jun 23, 2023
1 parent 336edab commit 3b9001b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
5 changes: 5 additions & 0 deletions examples/gno.land/p/demo/tests/subtests/subtests_test.gno
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package subtests_test

func TestPrivate(t *testing.T) {
println("hello from private test")
}
5 changes: 2 additions & 3 deletions gnovm/cmd/gno/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,9 @@ func gnoTestPkg(
stdin = io.In
stdout = io.Out
stderr = io.Err
errs error
)

filter := splitRegexp(runFlag)
var errs error

mode := tests.ImportModeStdlibsOnly
if cfg.withNativeFallback {
// XXX: display a warn?
Expand Down Expand Up @@ -310,6 +308,7 @@ func gnoTestPkg(
for _, testFile := range filetestFiles {
testFileName := filepath.Base(testFile)
testName := "file/" + testFileName
filter := splitRegexp(runFlag)
if !shouldRun(filter, testName) {
continue
}
Expand Down
10 changes: 5 additions & 5 deletions gnovm/stdlibs/testing/match.gno
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,13 @@ func isSpace(r rune) bool {
return false
}

var (
matchPat string
matchRe *regexp.Regexp
)

// based on testing/internal/testdeps.TestDeps.MatchString.
func matchString(pat, str string) (result bool, err error) {
var (
matchPat string
matchRe *regexp.Regexp
)

if matchRe == nil || matchPat != pat {
matchPat = pat
matchRe, err = regexp.Compile(matchPat)
Expand Down

0 comments on commit 3b9001b

Please sign in to comment.