From 30f42655bcb14971686f37aaa02579500788a38f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 28 Dec 2024 18:42:59 +0100 Subject: [PATCH] build(deps): bump github.com/ldez/usetesting from 0.3.0 to 0.4.0 (#5264) Co-authored-by: Fernandez Ludovic --- go.mod | 2 +- go.sum | 4 ++-- .../usetesting/testdata/fix/in/usetesting.go | 15 +++++++++++++++ .../usetesting/testdata/fix/out/usetesting.go | 15 +++++++++++++++ .../usetesting/usetesting_integration_test.go | 8 ++++++++ 5 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 pkg/golinters/usetesting/testdata/fix/in/usetesting.go create mode 100644 pkg/golinters/usetesting/testdata/fix/out/usetesting.go diff --git a/go.mod b/go.mod index 38b45eb8b117..89100b2ade66 100644 --- a/go.mod +++ b/go.mod @@ -68,7 +68,7 @@ require ( github.com/ldez/gomoddirectives v0.6.0 github.com/ldez/grignotin v0.7.0 github.com/ldez/tagliatelle v0.7.1 - github.com/ldez/usetesting v0.3.0 + github.com/ldez/usetesting v0.4.0 github.com/leonklingele/grouper v1.1.2 github.com/macabu/inamedparam v0.1.3 github.com/maratori/testableexamples v1.0.0 diff --git a/go.sum b/go.sum index 35efcb297ecb..fe4fe0f80910 100644 --- a/go.sum +++ b/go.sum @@ -359,8 +359,8 @@ github.com/ldez/grignotin v0.7.0 h1:vh0dI32WhHaq6LLPZ38g7WxXuZ1+RzyrJ7iPG9JMa8c= github.com/ldez/grignotin v0.7.0/go.mod h1:uaVTr0SoZ1KBii33c47O1M8Jp3OP3YDwhZCmzT9GHEk= github.com/ldez/tagliatelle v0.7.1 h1:bTgKjjc2sQcsgPiT902+aadvMjCeMHrY7ly2XKFORIk= github.com/ldez/tagliatelle v0.7.1/go.mod h1:3zjxUpsNB2aEZScWiZTHrAXOl1x25t3cRmzfK1mlo2I= -github.com/ldez/usetesting v0.3.0 h1:WAEYgzbmJHUDTlEBbb5lkobZjq26gtKIZJrNX3z72tQ= -github.com/ldez/usetesting v0.3.0/go.mod h1:9Tk8OH9NL3Xi7lpvkGRpuY/cOmWmatxwVjRc+TkgLDg= +github.com/ldez/usetesting v0.4.0 h1:xF9LbsTSCchW6afA1Ed7fD3TXGxzlGQ2DbHB9WomI0s= +github.com/ldez/usetesting v0.4.0/go.mod h1:9Tk8OH9NL3Xi7lpvkGRpuY/cOmWmatxwVjRc+TkgLDg= github.com/leonklingele/grouper v1.1.2 h1:o1ARBDLOmmasUaNDesWqWCIFH3u7hoFlM84YrjT3mIY= github.com/leonklingele/grouper v1.1.2/go.mod h1:6D0M/HVkhs2yRKRFZUoGjeDy7EZTfFBE9gl4kjmIGkA= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= diff --git a/pkg/golinters/usetesting/testdata/fix/in/usetesting.go b/pkg/golinters/usetesting/testdata/fix/in/usetesting.go new file mode 100644 index 000000000000..2e15f3a50a71 --- /dev/null +++ b/pkg/golinters/usetesting/testdata/fix/in/usetesting.go @@ -0,0 +1,15 @@ +//golangcitest:args -Eusetesting +//golangcitest:expected_exitcode 0 +package testdata + +import ( + "os" + "testing" +) + +func Test_osCreateTemp(t *testing.T) { + os.CreateTemp("", "") // want `os\.CreateTemp\("", \.\.\.\) could be replaced by os\.CreateTemp\(t\.TempDir\(\), \.\.\.\) in .+` + os.CreateTemp("", "xx") // want `os\.CreateTemp\("", \.\.\.\) could be replaced by os\.CreateTemp\(t\.TempDir\(\), \.\.\.\) in .+` + os.CreateTemp(os.TempDir(), "xx") + os.CreateTemp(t.TempDir(), "xx") +} diff --git a/pkg/golinters/usetesting/testdata/fix/out/usetesting.go b/pkg/golinters/usetesting/testdata/fix/out/usetesting.go new file mode 100644 index 000000000000..fa1b88d4b8f8 --- /dev/null +++ b/pkg/golinters/usetesting/testdata/fix/out/usetesting.go @@ -0,0 +1,15 @@ +//golangcitest:args -Eusetesting +//golangcitest:expected_exitcode 0 +package testdata + +import ( + "os" + "testing" +) + +func Test_osCreateTemp(t *testing.T) { + os.CreateTemp(t.TempDir(), "") // want `os\.CreateTemp\("", \.\.\.\) could be replaced by os\.CreateTemp\(t\.TempDir\(\), \.\.\.\) in .+` + os.CreateTemp(t.TempDir(), "xx") // want `os\.CreateTemp\("", \.\.\.\) could be replaced by os\.CreateTemp\(t\.TempDir\(\), \.\.\.\) in .+` + os.CreateTemp(os.TempDir(), "xx") + os.CreateTemp(t.TempDir(), "xx") +} diff --git a/pkg/golinters/usetesting/usetesting_integration_test.go b/pkg/golinters/usetesting/usetesting_integration_test.go index 3ea6e1ffdaa5..0394b449b09b 100644 --- a/pkg/golinters/usetesting/usetesting_integration_test.go +++ b/pkg/golinters/usetesting/usetesting_integration_test.go @@ -9,3 +9,11 @@ import ( func TestFromTestdata(t *testing.T) { integration.RunTestdata(t) } + +func TestFix(t *testing.T) { + integration.RunFix(t) +} + +func TestFixPathPrefix(t *testing.T) { + integration.RunFixPathPrefix(t) +}