@@ -15,28 +15,34 @@ func init() {
1515
1616func TestValidator_Validate (t * testing.T ) {
1717 testCases := []struct {
18- Path string
19- IsValid bool
20- IgnoreTests bool
18+ Path string
19+ IsValid bool
20+ IgnoreTests bool
21+ IgnoredPackages []string
2122 }{
22- {"../examples/valid-simple" , true , false },
23- {"../examples/invalid-infra-in-domain-import" , false , false },
24- {"../examples/invalid-app-to-domain-import" , false , false },
25- {"../examples/invalid-cross-module-deps" , false , false },
26- {"../examples/valid-cross-module-deps" , true , false },
27- {"../examples/valid-imports-inside-module" , true , false },
28- {"../examples/invalid-imports-between-submodules" , false , false },
29- {"../examples/invalid-imports-between-submodules-2" , false , false },
30- {"../examples/ignored-dirs" , true , false },
31- {"../examples/ignored-dirs" , true , false },
32- {"../examples/invalid-infrastructure-to-app-import-in-tests" , true , true },
33- {"../examples/invalid-infrastructure-to-app-import-in-tests" , false , false },
23+ {Path : "../examples/valid-simple" , IsValid : true },
24+ {Path : "../examples/invalid-infra-in-domain-import" , IsValid : false },
25+ {Path : "../examples/invalid-app-to-domain-import" , IsValid : false },
26+ {Path : "../examples/invalid-cross-module-deps" , IsValid : false },
27+ {Path : "../examples/valid-cross-module-deps" , IsValid : true },
28+ {Path : "../examples/valid-imports-inside-module" , IsValid : true },
29+ {Path : "../examples/invalid-imports-between-submodules" , IsValid : false },
30+ {Path : "../examples/invalid-imports-between-submodules-2" , IsValid : false },
31+ {Path : "../examples/ignored-dirs" , IsValid : true },
32+ {Path : "../examples/ignored-dirs" , IsValid : true },
33+ {Path : "../examples/invalid-infrastructure-to-app-import-in-tests" , IsValid : true , IgnoreTests : true },
34+ {Path : "../examples/invalid-infrastructure-to-app-import-in-tests" , IsValid : false },
35+ {
36+ Path : "../examples/ignore-package" ,
37+ IsValid : true ,
38+ IgnoredPackages : []string {"github.com/roblaszczak/go-cleanarch/examples/ignore-package/app" },
39+ },
3440 }
3541
3642 for _ , c := range testCases {
3743 t .Run (c .Path , func (t * testing.T ) {
3844 validator := cleanarch .NewValidator ()
39- valid , errors , err := validator .Validate (c .Path , c .IgnoreTests )
45+ valid , errors , err := validator .Validate (c .Path , c .IgnoreTests , c . IgnoredPackages )
4046 if err != nil {
4147 t .Fatal (err )
4248 }
0 commit comments