diff --git a/completion/completion_test.go b/completion/completion_test.go index bc7a5076..0994743c 100644 --- a/completion/completion_test.go +++ b/completion/completion_test.go @@ -3,7 +3,7 @@ package completion import ( "testing" - "github.com/stretchr/testify/assert" + "github.com/alecthomas/assert/v2" ) func generator(match string) []string { @@ -40,7 +40,7 @@ func TestTabCompleter_Next(t *testing.T) { cmpl.Reset() next = cmpl.Next("") - assert.Empty(t, next) + assert.Equal(t, "", next) num = "none" next = cmpl.Next("none") @@ -77,7 +77,7 @@ func TestTabCompleter_Previous(t *testing.T) { cmpl.Reset() prev = cmpl.Previous("") - assert.Empty(t, prev) + assert.Equal(t, "", prev) num = "none" prev = cmpl.Previous("none") diff --git a/go.mod b/go.mod index ed95327b..49051706 100644 --- a/go.mod +++ b/go.mod @@ -4,17 +4,18 @@ go 1.21 require ( fyne.io/fyne/v2 v2.5.3 + github.com/alecthomas/assert/v2 v2.11.0 github.com/fynelabs/fyneselfupdate v0.1.1 github.com/fynelabs/selfupdate v0.2.0 github.com/klauspost/compress v1.17.11 github.com/rymdport/go-qrcode v1.2.0 github.com/rymdport/wormhole v0.1.1-0.20241116103349-4e36e05aff6c - github.com/stretchr/testify v1.9.0 ) require ( fyne.io/systray v1.11.0 // indirect github.com/BurntSushi/toml v1.4.0 // indirect + github.com/alecthomas/repr v0.4.0 // indirect github.com/coder/websocket v1.8.12 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/fredbi/uri v1.1.0 // indirect @@ -28,6 +29,7 @@ require ( github.com/go-text/typesetting v0.2.0 // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect github.com/gopherjs/gopherjs v1.17.2 // indirect + github.com/hexops/gotextdiff v1.0.3 // indirect github.com/jeandeaual/go-locale v0.0.0-20240223122105-ce5225dcaa49 // indirect github.com/jsummers/gobmp v0.0.0-20151104160322-e2ba15ffa76e // indirect github.com/nicksnyder/go-i18n/v2 v2.4.0 // indirect @@ -35,6 +37,7 @@ require ( github.com/rymdport/portal v0.3.0 // indirect github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c // indirect github.com/srwiley/rasterx v0.0.0-20220730225603-2ab79fcdd4ef // indirect + github.com/stretchr/testify v1.9.0 // indirect github.com/yuin/goldmark v1.7.1 // indirect golang.org/x/crypto v0.31.0 // indirect golang.org/x/image v0.18.0 // indirect diff --git a/go.sum b/go.sum index d19575c8..640c23ed 100644 --- a/go.sum +++ b/go.sum @@ -45,6 +45,10 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0= +github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= +github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc= +github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= @@ -202,6 +206,8 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= +github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= diff --git a/internal/transport/completion_test.go b/internal/transport/completion_test.go index 80d20349..74475b56 100644 --- a/internal/transport/completion_test.go +++ b/internal/transport/completion_test.go @@ -3,7 +3,7 @@ package transport import ( "testing" - "github.com/stretchr/testify/assert" + "github.com/alecthomas/assert/v2" ) var completions []string diff --git a/internal/util/reader_test.go b/internal/util/reader_test.go index 09665fd8..4f589081 100644 --- a/internal/util/reader_test.go +++ b/internal/util/reader_test.go @@ -4,7 +4,7 @@ import ( "bytes" "testing" - "github.com/stretchr/testify/assert" + "github.com/alecthomas/assert/v2" ) func TestProgressReader(t *testing.T) { diff --git a/internal/util/url_test.go b/internal/util/url_test.go index 92b62894..32bd2932 100644 --- a/internal/util/url_test.go +++ b/internal/util/url_test.go @@ -2,8 +2,9 @@ package util import ( "net/url" - "reflect" "testing" + + "github.com/alecthomas/assert/v2" ) func TestURLToGitHubProject(t *testing.T) { @@ -22,14 +23,10 @@ func TestURLToGitHubProject(t *testing.T) { t.Run(tt.name, func(t *testing.T) { path := basepath + tt.subpath want, err := url.Parse(path) - if err != nil { - t.Errorf("Failed to parse the path %s: %v", path, err) - return - } + assert.NoError(t, err) - if got := URLToGitHubProject(tt.subpath); !reflect.DeepEqual(got, want) { - t.Errorf("URLToGitHubProject() = %v, want %v", got, want) - } + got := URLToGitHubProject(tt.subpath) + assert.Equal(t, want, got) }) } } diff --git a/internal/util/util_test.go b/internal/util/util_test.go index 4739aa40..91566d69 100644 --- a/internal/util/util_test.go +++ b/internal/util/util_test.go @@ -5,7 +5,8 @@ import ( "testing" "fyne.io/fyne/v2" - "github.com/stretchr/testify/assert" + + "github.com/alecthomas/assert/v2" ) var globalValidationError error @@ -46,9 +47,7 @@ var codeValidatorTestcases = []struct { func TestCodeValidator(t *testing.T) { for _, tc := range codeValidatorTestcases { out := CodeValidator(tc.in) - if out != tc.want { - t.Errorf("CodeValidator with input \"%s\" returned: %v, want \"%v\"", tc.in, out, tc.want) - } + assert.Equal(t, tc.want, out) } }