diff --git a/gno.land/pkg/integration/testdata_test.go b/gno.land/pkg/integration/testdata_test.go new file mode 100644 index 00000000000..c947624de00 --- /dev/null +++ b/gno.land/pkg/integration/testdata_test.go @@ -0,0 +1,53 @@ +package integration + +import ( + "os" + "strconv" + "testing" + + gno_integration "github.com/gnolang/gno/gnovm/pkg/integration" + "github.com/rogpeppe/go-internal/testscript" + "github.com/stretchr/testify/require" +) + +var debugTs = false + +func init() { debugTs, _ = strconv.ParseBool(os.Getenv("DEBUG_TS")) } + +func TestTestdata(t *testing.T) { + t.Parallel() + + p := gno_integration.NewTestingParams(t, "testdata") + + if coverdir, ok := gno_integration.ResolveCoverageDir(); ok { + err := gno_integration.SetupTestscriptsCoverage(&p, coverdir) + require.NoError(t, err) + } + + // Set up gnoland for testscript + err := SetupGnolandTestscript(t, &p) + require.NoError(t, err) + + mode := commandKindTesting + if debugTs { + mode = commandKindInMemory + } + + origSetup := p.Setup + p.Setup = func(env *testscript.Env) error { + env.Values[envKeyExecCommand] = mode + if origSetup != nil { + if err := origSetup(env); err != nil { + return err + } + } + + return nil + } + + if debugTs { + testscript.RunT(tSeqShim{t}, p) + } else { + testscript.Run(t, p) + } +} diff --git a/gno.land/pkg/integration/testscript_integration_test.go b/gno.land/pkg/integration/testscript_gnoland_test.go similarity index 58% rename from gno.land/pkg/integration/testscript_integration_test.go rename to gno.land/pkg/integration/testscript_gnoland_test.go index ec884029e90..2c301064969 100644 --- a/gno.land/pkg/integration/testscript_integration_test.go +++ b/gno.land/pkg/integration/testscript_gnoland_test.go @@ -1,59 +1,13 @@ package integration import ( - "os" - "strconv" "strings" "testing" - gno_integration "github.com/gnolang/gno/gnovm/pkg/integration" - "github.com/rogpeppe/go-internal/testscript" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) -var debugTs = false - -func init() { debugTs, _ = strconv.ParseBool(os.Getenv("DEBUG_TS")) } - -func TestTestdata(t *testing.T) { - t.Parallel() - - p := gno_integration.NewTestingParams(t, "testdata") - - if coverdir, ok := gno_integration.ResolveCoverageDir(); ok { - err := gno_integration.SetupTestscriptsCoverage(&p, coverdir) - require.NoError(t, err) - } - - // Set up gnoland for testscript - err := SetupGnolandTestscript(t, &p) - require.NoError(t, err) - - mode := commandKindTesting - if debugTs { - mode = commandKindInMemory - } - - origSetup := p.Setup - p.Setup = func(env *testscript.Env) error { - env.Values[envKeyExecCommand] = mode - if origSetup != nil { - if err := origSetup(env); err != nil { - return err - } - } - - return nil - } - - if debugTs { - testscript.RunT(tSeqShim{t}, p) - } else { - testscript.Run(t, p) - } -} - func TestUnquote(t *testing.T) { t.Parallel()