Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

Commit

Permalink
fix: Skip test case
Browse files Browse the repository at this point in the history
  • Loading branch information
sivchari committed Jul 19, 2022
1 parent ba323be commit aafbd79
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nosnakecase.go
Expand Up @@ -50,6 +50,11 @@ func report(pass *analysis.Pass, pos token.Pos, name string) {
return
}

// If prefix is Test or Benchmark, Fuzz, skip
if strings.Contains(name, "Test") || strings.Contains(name, "Benchmark") || strings.Contains(name, "Fuzz") {
return
}

if strings.Contains(name, "_") {
pass.Reportf(pos, "%s contains underscore. You should use mixedCap or MixedCap.", name)
return
Expand Down
15 changes: 15 additions & 0 deletions testdata/src/a/a_test.go
@@ -0,0 +1,15 @@
package sandbox_test

import "testing"

func TestX(t *testing.T) {}
func Test_x(t *testing.T) {}
func TestX_x(t *testing.T) {}

func BenchmarkX(b *testing.B) {}
func Benchmark_x(b *testing.B) {}
func BenchmarkX_x(b *testing.B) {}

func FuzzX(f *testing.F) {}
func Fuzz_x(f *testing.F) {}
func FuzzX_x(f *testing.F) {}

0 comments on commit aafbd79

Please sign in to comment.