Skip to content

Commit

Permalink
refactor(test): from slice of struct to slice of string
Browse files Browse the repository at this point in the history
  • Loading branch information
lasiar committed Apr 28, 2024
1 parent 55ee7ac commit 60b3680
Showing 1 changed file with 9 additions and 25 deletions.
34 changes: 9 additions & 25 deletions analyzer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,40 +17,24 @@ const testValue = "hello_world"
func TestAnalyzer(t *testing.T) {
t.Parallel()

testCases := []struct {
dir string
}{
{
dir: "alias",
},

{
dir: "common",
},

{
dir: "embedded",
},

{
dir: "global",
},

{
dir: "struct",
},
testCases := [...]string{
"alias",
"common",
"embedded",
"global",
"struct",
}

for _, tt := range testCases {
tt := tt
t.Run(tt.dir, func(t *testing.T) {
t.Run(tt, func(t *testing.T) {
t.Parallel()

analysistest.RunWithSuggestedFixes(
t,
analysistest.TestData(),
canonicalheader.Analyzer,
tt.dir,
tt,
)
})
}
Expand All @@ -63,7 +47,7 @@ func TestAnalyzer(t *testing.T) {
require.Len(t, testCases, len(dirs))

for i, dir := range dirs {
require.Equal(t, dir.Name(), testCases[i].dir)
require.Equal(t, dir.Name(), testCases[i])
}
})
}
Expand Down

0 comments on commit 60b3680

Please sign in to comment.