@@ -572,6 +572,17 @@ func TestConfig_ShouldGenerateInterface(t *testing.T) {
572
572
want : false ,
573
573
wantErr : true ,
574
574
},
575
+ {
576
+ name : "invalid interfaces section returns error" ,
577
+ c : & Config {
578
+ Packages : map [string ]interface {}{
579
+ "some_package" : map [string ]interface {}{
580
+ "interfaces" : true ,
581
+ },
582
+ },
583
+ },
584
+ wantErr : true ,
585
+ },
575
586
{
576
587
name : "should generate all interfaces" ,
577
588
c : & Config {
@@ -733,6 +744,75 @@ func TestConfig_ShouldGenerateInterface(t *testing.T) {
733
744
},
734
745
want : true ,
735
746
},
747
+ {
748
+ name : "invalid include-regex is ignored if all is set" ,
749
+ c : & Config {
750
+ Packages : map [string ]interface {}{
751
+ "some_package" : map [string ]interface {}{
752
+ "config" : map [string ]interface {}{
753
+ "all" : true ,
754
+ "include-regex" : "[" ,
755
+ },
756
+ },
757
+ },
758
+ },
759
+ want : true ,
760
+ },
761
+ {
762
+ name : "invalid include-regex results in error" ,
763
+ c : & Config {
764
+ Packages : map [string ]interface {}{
765
+ "some_package" : map [string ]interface {}{
766
+ "config" : map [string ]interface {}{
767
+ "include-regex" : "[" ,
768
+ },
769
+ },
770
+ },
771
+ },
772
+ wantErr : true ,
773
+ },
774
+ {
775
+ name : "invalid exclude-regex is ignored if all is set" ,
776
+ c : & Config {
777
+ Packages : map [string ]interface {}{
778
+ "some_package" : map [string ]interface {}{
779
+ "config" : map [string ]interface {}{
780
+ "all" : true ,
781
+ "include-regex" : ".*" ,
782
+ "exclude-regex" : "[" ,
783
+ },
784
+ },
785
+ },
786
+ },
787
+ want : true ,
788
+ },
789
+ {
790
+ name : "invalid exclude-regex is ignored if include-regex is not set" ,
791
+ c : & Config {
792
+ Packages : map [string ]interface {}{
793
+ "some_package" : map [string ]interface {}{
794
+ "config" : map [string ]interface {}{
795
+ "exclude-regex" : "[" ,
796
+ },
797
+ },
798
+ },
799
+ },
800
+ want : false ,
801
+ },
802
+ {
803
+ name : "invalid exclude-regex results in error" ,
804
+ c : & Config {
805
+ Packages : map [string ]interface {}{
806
+ "some_package" : map [string ]interface {}{
807
+ "config" : map [string ]interface {}{
808
+ "include-regex" : ".*" ,
809
+ "exclude-regex" : "[" ,
810
+ },
811
+ },
812
+ },
813
+ },
814
+ wantErr : true ,
815
+ },
736
816
}
737
817
for _ , tt := range tests {
738
818
t .Run (tt .name , func (t * testing.T ) {
0 commit comments