@@ -128,9 +128,9 @@ func TestExclusionPaths_Process(t *testing.T) {
128
128
{RelativePath : filepath .FromSlash ("base/d/file.go" )},
129
129
},
130
130
expected : []result.Issue {
131
- {RelativePath : filepath .FromSlash ("base/a /file.go" )},
132
- {RelativePath : filepath .FromSlash ("base/b /file.go" )},
133
- {RelativePath : filepath .FromSlash ("base/d /file.go" )},
131
+ {RelativePath : filepath .FromSlash ("base/c /file.go" )},
132
+ {RelativePath : filepath .FromSlash ("base/c/a /file.go" )},
133
+ {RelativePath : filepath .FromSlash ("base/c/b /file.go" )},
134
134
},
135
135
},
136
136
{
@@ -151,9 +151,9 @@ func TestExclusionPaths_Process(t *testing.T) {
151
151
{RelativePath : filepath .FromSlash ("base/d/file.go" )},
152
152
},
153
153
expected : []result.Issue {
154
- {RelativePath : filepath .FromSlash ("base/a /file.go" )},
155
- {RelativePath : filepath .FromSlash ("base/b /file.go" )},
156
- {RelativePath : filepath .FromSlash ("base/d /file.go" )},
154
+ {RelativePath : filepath .FromSlash ("base/c /file.go" )},
155
+ {RelativePath : filepath .FromSlash ("base/c/a /file.go" )},
156
+ {RelativePath : filepath .FromSlash ("base/c/b /file.go" )},
157
157
},
158
158
},
159
159
{
@@ -174,13 +174,14 @@ func TestExclusionPaths_Process(t *testing.T) {
174
174
{RelativePath : filepath .FromSlash ("base/e/file.go" )},
175
175
},
176
176
expected : []result.Issue {
177
- {RelativePath : filepath .FromSlash ("base/a/file.go" )},
178
- {RelativePath : filepath .FromSlash ("base/b/file.go" )},
179
- {RelativePath : filepath .FromSlash ("base/d/file.go" )},
177
+ {RelativePath : filepath .FromSlash ("base/c/file.go" )},
178
+ {RelativePath : filepath .FromSlash ("base/c/a/file.go" )},
179
+ {RelativePath : filepath .FromSlash ("base/c/b/file.go" )},
180
+ {RelativePath : filepath .FromSlash ("base/e/file.go" )},
180
181
},
181
182
},
182
183
{
183
- desc : "pathsExcept and paths" ,
184
+ desc : "pathsExcept and paths (disjoint) " ,
184
185
cfg : & config.LinterExclusions {
185
186
Paths : []string {"^base/b/" },
186
187
PathsExcept : []string {`^base/c/.*$` },
@@ -194,9 +195,29 @@ func TestExclusionPaths_Process(t *testing.T) {
194
195
{RelativePath : filepath .FromSlash ("base/d/file.go" )},
195
196
},
196
197
expected : []result.Issue {
198
+ {RelativePath : filepath .FromSlash ("base/c/file.go" )},
199
+ {RelativePath : filepath .FromSlash ("base/c/a/file.go" )},
200
+ {RelativePath : filepath .FromSlash ("base/c/b/file.go" )},
201
+ },
202
+ },
203
+ {
204
+ desc : "pathsExcept and paths (intersection)" ,
205
+ cfg : & config.LinterExclusions {
206
+ Paths : []string {"^base/c/a/" },
207
+ PathsExcept : []string {`^base/c/.*$` },
208
+ },
209
+ issues : []result.Issue {
197
210
{RelativePath : filepath .FromSlash ("base/a/file.go" )},
211
+ {RelativePath : filepath .FromSlash ("base/b/file.go" )},
212
+ {RelativePath : filepath .FromSlash ("base/c/file.go" )},
213
+ {RelativePath : filepath .FromSlash ("base/c/a/file.go" )},
214
+ {RelativePath : filepath .FromSlash ("base/c/b/file.go" )},
198
215
{RelativePath : filepath .FromSlash ("base/d/file.go" )},
199
216
},
217
+ expected : []result.Issue {
218
+ {RelativePath : filepath .FromSlash ("base/c/file.go" )},
219
+ {RelativePath : filepath .FromSlash ("base/c/b/file.go" )},
220
+ },
200
221
},
201
222
}
202
223
0 commit comments