@@ -101,9 +101,7 @@ func TestIncludesAndExcludes(t *testing.T) {
101
101
as .Contains (string (out ), fmt .Sprintf ("%d files changed" , 29 ))
102
102
103
103
// globally exclude nix files
104
- config .Global = struct { Excludes []string }{
105
- Excludes : []string {"*.nix" },
106
- }
104
+ config .Global .Excludes = []string {"*.nix" }
107
105
108
106
test .WriteConfig (t , configPath , config )
109
107
out , err = cmd (t , "-c" , "--config-file" , configPath , "--tree-root" , tempDir )
@@ -118,32 +116,34 @@ func TestIncludesAndExcludes(t *testing.T) {
118
116
as .NoError (err )
119
117
as .Contains (string (out ), fmt .Sprintf ("%d files changed" , 22 ))
120
118
119
+ echo := config .Formatters ["echo" ]
120
+
121
121
// remove python files from the echo formatter
122
- config . Formatters [ " echo" ] .Excludes = []string {"*.py" }
122
+ echo .Excludes = []string {"*.py" }
123
123
124
124
test .WriteConfig (t , configPath , config )
125
125
out , err = cmd (t , "-c" , "--config-file" , configPath , "--tree-root" , tempDir )
126
126
as .NoError (err )
127
127
as .Contains (string (out ), fmt .Sprintf ("%d files changed" , 20 ))
128
128
129
129
// remove go files from the echo formatter
130
- config . Formatters [ " echo" ] .Excludes = []string {"*.py" , "*.go" }
130
+ echo .Excludes = []string {"*.py" , "*.go" }
131
131
132
132
test .WriteConfig (t , configPath , config )
133
133
out , err = cmd (t , "-c" , "--config-file" , configPath , "--tree-root" , tempDir )
134
134
as .NoError (err )
135
135
as .Contains (string (out ), fmt .Sprintf ("%d files changed" , 19 ))
136
136
137
137
// adjust the includes for echo to only include elm files
138
- config . Formatters [ " echo" ] .Includes = []string {"*.elm" }
138
+ echo .Includes = []string {"*.elm" }
139
139
140
140
test .WriteConfig (t , configPath , config )
141
141
out , err = cmd (t , "-c" , "--config-file" , configPath , "--tree-root" , tempDir )
142
142
as .NoError (err )
143
143
as .Contains (string (out ), fmt .Sprintf ("%d files changed" , 1 ))
144
144
145
145
// add js files to echo formatter
146
- config . Formatters [ " echo" ] .Includes = []string {"*.elm" , "*.js" }
146
+ echo .Includes = []string {"*.elm" , "*.js" }
147
147
148
148
test .WriteConfig (t , configPath , config )
149
149
out , err = cmd (t , "-c" , "--config-file" , configPath , "--tree-root" , tempDir )
0 commit comments