diff --git a/go.mod b/go.mod index 30277f8..ea844d2 100644 --- a/go.mod +++ b/go.mod @@ -3,13 +3,9 @@ module github.com/logica0419/resigif go 1.22.2 require ( - github.com/stretchr/testify v1.9.0 + github.com/youta-t/its v0.5.0 golang.org/x/image v0.19.0 golang.org/x/sync v0.8.0 ) -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) +require golang.org/x/mod v0.20.0 // indirect diff --git a/go.sum b/go.sum index c76aae4..619d4b5 100644 --- a/go.sum +++ b/go.sum @@ -1,14 +1,10 @@ -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/youta-t/its v0.5.0 h1:KScN5T5OHZPcj4KdPWmoOjLSyMRbG21LPB2dijxQKQA= +github.com/youta-t/its v0.5.0/go.mod h1:BIW52yCMszkfw3y00YtIB5I5EP10+vVJFu3cV78DqlU= golang.org/x/image v0.19.0 h1:D9FX4QWkLfkeqaC62SonffIIuYdOk/UE2XKUBgRIBIQ= golang.org/x/image v0.19.0/go.mod h1:y0zrRqlQRWQ5PXaYCOMLTW2fpsxZ8Qh9I/ohnInJEys= +golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= +golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/resigif_test.go b/resigif_test.go index a6cec41..42508f5 100644 --- a/resigif_test.go +++ b/resigif_test.go @@ -10,8 +10,7 @@ import ( "github.com/logica0419/resigif" "github.com/logica0419/resigif/testdata" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" + "github.com/youta-t/its" "golang.org/x/image/draw" ) @@ -21,14 +20,14 @@ func mustOpenGif(t *testing.T, name string) *gif.GIF { t.Helper() file, err := testdata.FS.Open(name) - require.NoError(t, err) + its.Nil[error]().Match(err).OrFatal(t) defer func() { _ = file.Close() }() image, err := gif.DecodeAll(file) - require.NoError(t, err) + its.Nil[error]().Match(err).OrFatal(t) return image } @@ -37,14 +36,14 @@ func mustEncodeGif(t *testing.T, name string, image *gif.GIF) { t.Helper() file, err := os.OpenFile(filepath.Clean("testdata/"+name), os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0o600) - require.NoError(t, err) + its.Nil[error]().Match(err).OrFatal(t) defer func() { _ = file.Close() }() err = gif.EncodeAll(file, image) - require.NoError(t, err) + its.Nil[error]().Match(err).OrFatal(t) } func TestResize(t *testing.T) { @@ -61,10 +60,10 @@ func TestResize(t *testing.T) { } tests := []struct { - name string - args args - want string - assertion require.ErrorAssertionFunc + name string + args args + want string + errMatcher its.Matcher[error] }{ { name: "success (mushroom 正方形、小サイズ)", @@ -77,8 +76,8 @@ func TestResize(t *testing.T) { resigif.WithAspectRatio(resigif.Ignore), }, }, - want: "mushroom_resized.gif", - assertion: require.NoError, + want: "mushroom_resized.gif", + errMatcher: its.Nil[error](), }, { name: "success (tooth 正方形、DisposalBackground)", @@ -91,8 +90,8 @@ func TestResize(t *testing.T) { resigif.WithParallel(1), }, }, - want: "tooth_resized.gif", - assertion: require.NoError, + want: "tooth_resized.gif", + errMatcher: its.Nil[error](), }, { name: "success (new_year 横長)", @@ -105,8 +104,8 @@ func TestResize(t *testing.T) { resigif.WithImageResizeFunc(resigif.FromDrawScaler(draw.BiLinear)), }, }, - want: "new_year_resized.gif", - assertion: require.NoError, + want: "new_year_resized.gif", + errMatcher: its.Nil[error](), }, { name: "success (miku 縦長、差分最適化)", @@ -117,8 +116,8 @@ func TestResize(t *testing.T) { height: 256, opts: nil, }, - want: "miku_resized.gif", - assertion: require.NoError, + want: "miku_resized.gif", + errMatcher: its.Nil[error](), }, { name: "success (frog 縦長、DisposalBackground + 背景色不整合)", @@ -129,8 +128,8 @@ func TestResize(t *testing.T) { height: 256, opts: nil, }, - want: "frog_resized.gif", - assertion: require.NoError, + want: "frog_resized.gif", + errMatcher: its.Nil[error](), }, { name: "success (surprised 正方形、空のGlobal Color Table)", @@ -141,8 +140,8 @@ func TestResize(t *testing.T) { height: 256, opts: nil, }, - want: "surprised_resized.gif", - assertion: require.NoError, + want: "surprised_resized.gif", + errMatcher: its.Nil[error](), }, } @@ -156,8 +155,8 @@ func TestResize(t *testing.T) { mustEncodeGif(t, tt.want, got) } - tt.assertion(t, err) - assert.Equal(t, mustOpenGif(t, tt.want), got) + tt.errMatcher.Match(err).OrError(t) + its.DeepEqual(mustOpenGif(t, tt.want)).Match(got).OrError(t) }) } }