diff --git a/.circleci/config.yml b/.circleci/config.yml index 6a73f72d..2ccdf763 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,22 +12,27 @@ workflows: executor: name: go/golang tag: 1.18-alpine - post-steps: &xgenerics + post-steps: &othermods - run: name: "test x/generics" working_directory: ./x/generics command: gotestsum -ftestname + - run: + name: "test cmd/migrate-from-testify" + working_directory: ./cmd/migrate-from-testify + command: gotestsum -ftestname - go/test: name: test-golang-1.19 executor: name: go/golang tag: 1.19-alpine - post-steps: *xgenerics + post-steps: *othermods - go/test: name: test-golang-1.20 executor: name: go/golang tag: 1.20-alpine + post-steps: *othermods - go/test: name: test-windows executor: windows diff --git a/assert/cmd/gty-migrate-from-testify/call.go b/cmd/migrate-from-testify/call.go similarity index 100% rename from assert/cmd/gty-migrate-from-testify/call.go rename to cmd/migrate-from-testify/call.go diff --git a/assert/cmd/gty-migrate-from-testify/call_test.go b/cmd/migrate-from-testify/call_test.go similarity index 100% rename from assert/cmd/gty-migrate-from-testify/call_test.go rename to cmd/migrate-from-testify/call_test.go diff --git a/assert/cmd/gty-migrate-from-testify/doc.go b/cmd/migrate-from-testify/doc.go similarity index 100% rename from assert/cmd/gty-migrate-from-testify/doc.go rename to cmd/migrate-from-testify/doc.go diff --git a/assert/cmd/gty-migrate-from-testify/flags.go b/cmd/migrate-from-testify/flags.go similarity index 100% rename from assert/cmd/gty-migrate-from-testify/flags.go rename to cmd/migrate-from-testify/flags.go diff --git a/cmd/migrate-from-testify/go.mod b/cmd/migrate-from-testify/go.mod new file mode 100644 index 00000000..3bc56750 --- /dev/null +++ b/cmd/migrate-from-testify/go.mod @@ -0,0 +1,14 @@ +module gotest.tools/cmd/migrate-from-testify + +go 1.19 + +require ( + github.com/google/go-cmp v0.5.9 + golang.org/x/tools v0.10.0 + gotest.tools/v3 v3.5.0 +) + +require ( + golang.org/x/mod v0.11.0 // indirect + golang.org/x/sys v0.9.0 // indirect +) diff --git a/cmd/migrate-from-testify/go.sum b/cmd/migrate-from-testify/go.sum new file mode 100644 index 00000000..fcb950e9 --- /dev/null +++ b/cmd/migrate-from-testify/go.sum @@ -0,0 +1,11 @@ +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU= +golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/tools v0.10.0 h1:tvDr/iQoUqNdohiYm0LmmKcBk+q86lb9EprIUFhHHGg= +golang.org/x/tools v0.10.0/go.mod h1:UJwyiVBsOA2uwvK/e5OY3GTpDUJriEd+/YlqAwLPmyM= +gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY= +gotest.tools/v3 v3.5.0/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= diff --git a/assert/cmd/gty-migrate-from-testify/main.go b/cmd/migrate-from-testify/main.go similarity index 100% rename from assert/cmd/gty-migrate-from-testify/main.go rename to cmd/migrate-from-testify/main.go diff --git a/assert/cmd/gty-migrate-from-testify/main_test.go b/cmd/migrate-from-testify/main_test.go similarity index 99% rename from assert/cmd/gty-migrate-from-testify/main_test.go rename to cmd/migrate-from-testify/main_test.go index d7f59680..a3326b23 100644 --- a/assert/cmd/gty-migrate-from-testify/main_test.go +++ b/cmd/migrate-from-testify/main_test.go @@ -19,6 +19,7 @@ func TestRun(t *testing.T) { defer env.Patch(t, "GO111MODULE", "off")() defer env.Patch(t, "GOPATH", dir.Path())() + err := run(options{ pkgs: []string{"example.com/example"}, showLoaderErrors: true, diff --git a/assert/cmd/gty-migrate-from-testify/migrate.go b/cmd/migrate-from-testify/migrate.go similarity index 100% rename from assert/cmd/gty-migrate-from-testify/migrate.go rename to cmd/migrate-from-testify/migrate.go diff --git a/assert/cmd/gty-migrate-from-testify/migrate_test.go b/cmd/migrate-from-testify/migrate_test.go similarity index 100% rename from assert/cmd/gty-migrate-from-testify/migrate_test.go rename to cmd/migrate-from-testify/migrate_test.go diff --git a/assert/cmd/gty-migrate-from-testify/testdata/full-expected/some_test.go b/cmd/migrate-from-testify/testdata/full-expected/some_test.go similarity index 94% rename from assert/cmd/gty-migrate-from-testify/testdata/full-expected/some_test.go rename to cmd/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/cmd/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/cmd/migrate-from-testify/testdata/full/some_test.go similarity index 94% rename from assert/cmd/gty-migrate-from-testify/testdata/full/some_test.go rename to cmd/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/cmd/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) { diff --git a/assert/cmd/gty-migrate-from-testify/walktype.go b/cmd/migrate-from-testify/walktype.go similarity index 100% rename from assert/cmd/gty-migrate-from-testify/walktype.go rename to cmd/migrate-from-testify/walktype.go