@@ -128,9 +128,9 @@ func TestExclusionPaths_Process(t *testing.T) {
128128 {RelativePath : filepath .FromSlash ("base/d/file.go" )},
129129 },
130130 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" )},
134134 },
135135 },
136136 {
@@ -151,9 +151,9 @@ func TestExclusionPaths_Process(t *testing.T) {
151151 {RelativePath : filepath .FromSlash ("base/d/file.go" )},
152152 },
153153 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" )},
157157 },
158158 },
159159 {
@@ -174,13 +174,14 @@ func TestExclusionPaths_Process(t *testing.T) {
174174 {RelativePath : filepath .FromSlash ("base/e/file.go" )},
175175 },
176176 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" )},
180181 },
181182 },
182183 {
183- desc : "pathsExcept and paths" ,
184+ desc : "pathsExcept and paths (disjoint) " ,
184185 cfg : & config.LinterExclusions {
185186 Paths : []string {"^base/b/" },
186187 PathsExcept : []string {`^base/c/.*$` },
@@ -194,9 +195,29 @@ func TestExclusionPaths_Process(t *testing.T) {
194195 {RelativePath : filepath .FromSlash ("base/d/file.go" )},
195196 },
196197 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 {
197210 {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" )},
198215 {RelativePath : filepath .FromSlash ("base/d/file.go" )},
199216 },
217+ expected : []result.Issue {
218+ {RelativePath : filepath .FromSlash ("base/c/file.go" )},
219+ {RelativePath : filepath .FromSlash ("base/c/b/file.go" )},
220+ },
200221 },
201222 }
202223
0 commit comments