diff --git a/assert/cmd/gty-migrate-from-testify/main_test.go b/assert/cmd/gty-migrate-from-testify/main_test.go index d7f59680..2d526c2d 100644 --- a/assert/cmd/gty-migrate-from-testify/main_test.go +++ b/assert/cmd/gty-migrate-from-testify/main_test.go @@ -2,6 +2,7 @@ package main import ( "os" + "os/exec" "testing" "github.com/google/go-cmp/cmp" @@ -11,6 +12,14 @@ import ( "gotest.tools/v3/golden" ) +func goGet(t *testing.T, pkg string) { + t.Log("go get", pkg) + cmd := exec.Command("go", "get", pkg) + if err := cmd.Run(); err != nil { + t.Fatal(err) + } +} + func TestRun(t *testing.T) { setupLogging(&options{}) dir := fs.NewDir(t, "test-run", @@ -19,6 +28,13 @@ func TestRun(t *testing.T) { defer env.Patch(t, "GO111MODULE", "off")() defer env.Patch(t, "GOPATH", dir.Path())() + + // Fetch dependencies in GOPATH mode + // Check list in testdata/full/some_test.go + goGet(t, "gopkg.in/check.v1") + goGet(t, "github.com/stretchr/testify/assert") + goGet(t, "github.com/stretchr/testify/require") + err := run(options{ pkgs: []string{"example.com/example"}, showLoaderErrors: true, diff --git a/assert/cmd/gty-migrate-from-testify/testdata/full-expected/some_test.go b/assert/cmd/gty-migrate-from-testify/testdata/full-expected/some_test.go index 1cbdf0fb..78ae5247 100644 --- a/assert/cmd/gty-migrate-from-testify/testdata/full-expected/some_test.go +++ b/assert/cmd/gty-migrate-from-testify/testdata/full-expected/some_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/go-check/check" + "gopkg.in/check.v1" "gotest.tools/v3/assert" "gotest.tools/v3/assert/cmp" ) @@ -134,9 +134,13 @@ func TestTableTest(t *testing.T) { } } -func TestWithChecker(c *check.C) { +type MySuite struct{} + +var _ = check.Suite(&MySuite{}) + +func (s *MySuite) TestWithChecker(c *check.C) { var err error - assert.Check(c, err) + c.Assert(err, check.Equals, nil) } func HelperWithAssertTestingT(t assert.TestingT) { diff --git a/assert/cmd/gty-migrate-from-testify/testdata/full/some_test.go b/assert/cmd/gty-migrate-from-testify/testdata/full/some_test.go index f510038f..f7adb021 100644 --- a/assert/cmd/gty-migrate-from-testify/testdata/full/some_test.go +++ b/assert/cmd/gty-migrate-from-testify/testdata/full/some_test.go @@ -4,9 +4,9 @@ import ( "fmt" "testing" - "github.com/go-check/check" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "gopkg.in/check.v1" ) type mystruct struct { @@ -135,9 +135,13 @@ func TestTableTest(t *testing.T) { } } -func TestWithChecker(c *check.C) { +type MySuite struct{} + +var _ = check.Suite(&MySuite{}) + +func (s *MySuite) TestWithChecker(c *check.C) { var err error - assert.NoError(c, err) + c.Assert(err, check.Equals, nil) } func HelperWithAssertTestingT(t assert.TestingT) {