Skip to content

Commit

Permalink
fix: remove testing.F
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Dec 2, 2024
1 parent 4a13e50 commit f08212c
Show file tree
Hide file tree
Showing 22 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion testdata/src/contextbackground/basic/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func Test_NoName(_ *testing.T) {
context.Background() // want `context\.Background\(\) could be replaced by <t/b/f>\.Context\(\) in .+`
context.Background() // want `context\.Background\(\) could be replaced by <t/b>\.Context\(\) in .+`
}

func Benchmark_ExprStmt(b *testing.B) {
Expand Down
2 changes: 1 addition & 1 deletion testdata/src/contextbackground/dot/dot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

func Test_NoName(_ *testing.T) {
Background() // want `context\.Background\(\) could be replaced by <t/b/f>\.Context\(\) in .+`
Background() // want `context\.Background\(\) could be replaced by <t/b>\.Context\(\) in .+`
}

func Benchmark_ExprStmt(b *testing.B) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func FunctionNoName(_ *testing.T) {
context.Background() // want `context\.Background\(\) could be replaced by <t/b/f>\.Context\(\) in .+`
context.Background() // want `context\.Background\(\) could be replaced by <t/b>\.Context\(\) in .+`
}

func FunctionTB(tb testing.TB) {
Expand Down
2 changes: 1 addition & 1 deletion testdata/src/contexttodo/basic/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func Test_NoName(_ *testing.T) {
context.TODO() // want `context\.TODO\(\) could be replaced by <t/b/f>\.Context\(\) in .+`
context.TODO() // want `context\.TODO\(\) could be replaced by <t/b>\.Context\(\) in .+`
}

func Benchmark_ExprStmt(b *testing.B) {
Expand Down
2 changes: 1 addition & 1 deletion testdata/src/contexttodo/dot/dot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

func Test_NoName(_ *testing.T) {
TODO() // want `context\.TODO\(\) could be replaced by <t/b/f>\.Context\(\) in .+`
TODO() // want `context\.TODO\(\) could be replaced by <t/b>\.Context\(\) in .+`
}

func Benchmark_ExprStmt(b *testing.B) {
Expand Down
2 changes: 1 addition & 1 deletion testdata/src/contexttodo/nottestfiles/nottestfiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func FunctionNoName(_ *testing.T) {
context.TODO() // want `context\.TODO\(\) could be replaced by <t/b/f>\.Context\(\) in .+`
context.TODO() // want `context\.TODO\(\) could be replaced by <t/b>\.Context\(\) in .+`
}

func FunctionTB(tb testing.TB) {
Expand Down
2 changes: 1 addition & 1 deletion testdata/src/oschdir/basic/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

func Test_NoName(_ *testing.T) {
os.Chdir("") // want `os\.Chdir\(\) could be replaced by <t/b/f>\.Chdir\(\) in .+`
os.Chdir("") // want `os\.Chdir\(\) could be replaced by <t/b>\.Chdir\(\) in .+`
}

func Benchmark_ExprStmt(b *testing.B) {
Expand Down
2 changes: 1 addition & 1 deletion testdata/src/oschdir/dot/dot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

func Test_NoName(_ *testing.T) {
Chdir("") // want `os\.Chdir\(\) could be replaced by <t/b/f>\.Chdir\(\) in .+`
Chdir("") // want `os\.Chdir\(\) could be replaced by <t/b>\.Chdir\(\) in .+`
}

func Benchmark_ExprStmt(b *testing.B) {
Expand Down
2 changes: 1 addition & 1 deletion testdata/src/oschdir/nottestfiles/nottestfiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

func FunctionNoName(_ *testing.T) {
os.Chdir("") // want `os\.Chdir\(\) could be replaced by <t/b/f>\.Chdir\(\) in .+`
os.Chdir("") // want `os\.Chdir\(\) could be replaced by <t/b>\.Chdir\(\) in .+`
}

func FunctionTB(tb testing.TB) {
Expand Down
2 changes: 1 addition & 1 deletion testdata/src/oscreatetemp/basic/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func Test_NoName(_ *testing.T) {
os.CreateTemp("", "") // want `os\.CreateTemp\("", \.\.\.\) could be replaced by os\.CreateTemp\(<t/b/f>\.TempDir\(\), \.\.\.\) in .+`
os.CreateTemp("", "") // want `os\.CreateTemp\("", \.\.\.\) could be replaced by os\.CreateTemp\(<t/b>\.TempDir\(\), \.\.\.\) in .+`
}

func Benchmark_ExprStmt(b *testing.B) {
Expand Down
2 changes: 1 addition & 1 deletion testdata/src/oscreatetemp/dot/dot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func Test_NoName(_ *testing.T) {
CreateTemp("", "") // want `os\.CreateTemp\("", \.\.\.\) could be replaced by os\.CreateTemp\(<t/b/f>\.TempDir\(\), \.\.\.\) in .+`
CreateTemp("", "") // want `os\.CreateTemp\("", \.\.\.\) could be replaced by os\.CreateTemp\(<t/b>\.TempDir\(\), \.\.\.\) in .+`
}

func Benchmark_ExprStmt(b *testing.B) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func FunctionNoName(_ *testing.T) {
os.CreateTemp("", "") // want `os\.CreateTemp\("", \.\.\.\) could be replaced by os\.CreateTemp\(<t/b/f>\.TempDir\(\), \.\.\.\) in .+`
os.CreateTemp("", "") // want `os\.CreateTemp\("", \.\.\.\) could be replaced by os\.CreateTemp\(<t/b>\.TempDir\(\), \.\.\.\) in .+`
}

func FunctionTB(tb testing.TB) {
Expand Down
2 changes: 1 addition & 1 deletion testdata/src/osmkdirtemp/basic/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func Test_NoName(_ *testing.T) {
os.MkdirTemp("", "") // want `os\.MkdirTemp\(\) could be replaced by <t/b/f>\.TempDir\(\) in .+`
os.MkdirTemp("", "") // want `os\.MkdirTemp\(\) could be replaced by <t/b>\.TempDir\(\) in .+`
}

func Benchmark_ExprStmt(b *testing.B) {
Expand Down
2 changes: 1 addition & 1 deletion testdata/src/osmkdirtemp/dot/dot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func Test_NoName(_ *testing.T) {
MkdirTemp("", "") // want `os\.MkdirTemp\(\) could be replaced by <t/b/f>\.TempDir\(\) in .+`
MkdirTemp("", "") // want `os\.MkdirTemp\(\) could be replaced by <t/b>\.TempDir\(\) in .+`
}

func Benchmark_ExprStmt(b *testing.B) {
Expand Down
2 changes: 1 addition & 1 deletion testdata/src/osmkdirtemp/nottestfiles/nottestfiles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func FunctionNoName(_ *testing.T) {
os.MkdirTemp("", "") // want `os\.MkdirTemp\(\) could be replaced by <t/b/f>\.TempDir\(\) in .+`
os.MkdirTemp("", "") // want `os\.MkdirTemp\(\) could be replaced by <t/b>\.TempDir\(\) in .+`
}

func FunctionTB(tb testing.TB) {
Expand Down
2 changes: 1 addition & 1 deletion testdata/src/ossetenv/basic/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func Test_NoName(_ *testing.T) {
os.Setenv("", "") // want `os\.Setenv\(\) could be replaced by <t/b/f>\.Setenv\(\) in .+`
os.Setenv("", "") // want `os\.Setenv\(\) could be replaced by <t/b>\.Setenv\(\) in .+`
}

func Benchmark_ExprStmt(b *testing.B) {
Expand Down
2 changes: 1 addition & 1 deletion testdata/src/ossetenv/dot/dot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func Test_NoName(_ *testing.T) {
Setenv("", "") // want `os\.Setenv\(\) could be replaced by <t/b/f>\.Setenv\(\) in .+`
Setenv("", "") // want `os\.Setenv\(\) could be replaced by <t/b>\.Setenv\(\) in .+`
}

func Benchmark_ExprStmt(b *testing.B) {
Expand Down
2 changes: 1 addition & 1 deletion testdata/src/ossetenv/nottestfiles/nottestfiles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func FunctionNoName(_ *testing.T) {
os.Setenv("", "") // want `os\.Setenv\(\) could be replaced by <t/b/f>\.Setenv\(\) in .+`
os.Setenv("", "") // want `os\.Setenv\(\) could be replaced by <t/b>\.Setenv\(\) in .+`
}

func FunctionTB(tb testing.TB) {
Expand Down
2 changes: 1 addition & 1 deletion testdata/src/ostempdir/basic/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func Test_NoName(_ *testing.T) {
os.TempDir() // want `os\.TempDir\(\) could be replaced by <t/b/f>\.TempDir\(\) in .+`
os.TempDir() // want `os\.TempDir\(\) could be replaced by <t/b>\.TempDir\(\) in .+`
}

func Benchmark_ExprStmt(b *testing.B) {
Expand Down
2 changes: 1 addition & 1 deletion testdata/src/ostempdir/dot/dot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func Test_NoName(_ *testing.T) {
TempDir() // want `os\.TempDir\(\) could be replaced by <t/b/f>\.TempDir\(\) in .+`
TempDir() // want `os\.TempDir\(\) could be replaced by <t/b>\.TempDir\(\) in .+`
}

func Benchmark_ExprStmt(b *testing.B) {
Expand Down
2 changes: 1 addition & 1 deletion testdata/src/ostempdir/nottestfiles/nottestfiles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func FunctionNoName(_ *testing.T) {
os.TempDir() // want `os\.TempDir\(\) could be replaced by <t/b/f>\.TempDir\(\) in .+`
os.TempDir() // want `os\.TempDir\(\) could be replaced by <t/b>\.TempDir\(\) in .+`
}

func FunctionTB(tb testing.TB) {
Expand Down
4 changes: 2 additions & 2 deletions usetesting.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,9 @@ func isTestFunction(arg *ast.Field, pkgName string) (string, bool) {
switch at := arg.Type.(type) {
case *ast.StarExpr:
if se, ok := at.X.(*ast.SelectorExpr); ok {
argName := getTestArgName(arg, "<t/b/f>")
argName := getTestArgName(arg, "<t/b>")

return argName, checkSelectorName(se, pkgName, "T", "B", "F")
return argName, checkSelectorName(se, pkgName, "T", "B")
}

case *ast.SelectorExpr:
Expand Down

0 comments on commit f08212c

Please sign in to comment.