diff --git a/modules/l4socks/socks4_matcher_test.go b/modules/l4socks/socks4_matcher_test.go index 6757b70..9f9b7bd 100644 --- a/modules/l4socks/socks4_matcher_test.go +++ b/modules/l4socks/socks4_matcher_test.go @@ -2,6 +2,7 @@ package l4socks import ( "context" + "fmt" "io" "net" "testing" @@ -67,7 +68,7 @@ func TestSocks4Matcher_Match(t *testing.T) { defer cancel() for i, tc := range tests { - func() { + t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { err := tc.matcher.Provision(ctx) assertNoError(t, err) @@ -89,12 +90,12 @@ func TestSocks4Matcher_Match(t *testing.T) { if matched != tc.shouldMatch { if tc.shouldMatch { - t.Fatalf("test %d: matcher did not match | %+v\n", i, tc.matcher) + t.Fatalf("matcher did not match | %+v\n", tc.matcher) } else { - t.Fatalf("test %d: matcher should not match | %+v\n", i, tc.matcher) + t.Fatalf("matcher should not match | %+v\n", tc.matcher) } } - }() + }) } } diff --git a/modules/l4socks/socks5_matcher_test.go b/modules/l4socks/socks5_matcher_test.go index b1ff95d..7fc91f2 100644 --- a/modules/l4socks/socks5_matcher_test.go +++ b/modules/l4socks/socks5_matcher_test.go @@ -2,6 +2,7 @@ package l4socks import ( "context" + "fmt" "io" "net" "testing" @@ -44,7 +45,7 @@ func TestSocks5Matcher_Match(t *testing.T) { defer cancel() for i, tc := range tests { - func() { + t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { err := tc.matcher.Provision(ctx) assertNoError(t, err) @@ -66,11 +67,11 @@ func TestSocks5Matcher_Match(t *testing.T) { if matched != tc.shouldMatch { if tc.shouldMatch { - t.Fatalf("test %d: matcher did not match | %+v\n", i, tc.matcher) + t.Fatalf("matcher did not match | %+v\n", tc.matcher) } else { - t.Fatalf("test %d: matcher should not match | %+v\n", i, tc.matcher) + t.Fatalf("matcher should not match | %+v\n", tc.matcher) } } - }() + }) } }