@@ -47,6 +47,28 @@ func TestFilterByNames(t *testing.T) {
4747 container .AssertExpectations (t )
4848}
4949
50+ func TestFilterByNamesRegex (t * testing.T ) {
51+ names := []string {`ba(b|ll)oon` }
52+
53+ filter := FilterByNames (names , NoFilter )
54+ assert .NotNil (t , filter )
55+
56+ container := new (mocks.FilterableContainer )
57+ container .On ("Name" ).Return ("balloon" )
58+ assert .True (t , filter (container ))
59+ container .AssertExpectations (t )
60+
61+ container = new (mocks.FilterableContainer )
62+ container .On ("Name" ).Return ("spoon" )
63+ assert .False (t , filter (container ))
64+ container .AssertExpectations (t )
65+
66+ container = new (mocks.FilterableContainer )
67+ container .On ("Name" ).Return ("baboonious" )
68+ assert .False (t , filter (container ))
69+ container .AssertExpectations (t )
70+ }
71+
5072func TestFilterByEnableLabel (t * testing.T ) {
5173 filter := FilterByEnableLabel (NoFilter )
5274 assert .NotNil (t , filter )
@@ -68,8 +90,7 @@ func TestFilterByEnableLabel(t *testing.T) {
6890}
6991
7092func TestFilterByScope (t * testing.T ) {
71- var scope string
72- scope = "testscope"
93+ scope := "testscope"
7394
7495 filter := FilterByScope (scope , NoFilter )
7596 assert .NotNil (t , filter )
@@ -111,11 +132,12 @@ func TestFilterByDisabledLabel(t *testing.T) {
111132}
112133
113134func TestBuildFilter (t * testing.T ) {
114- var names []string
115- names = append (names , "test" )
135+ names := []string {"test" , "valid" }
116136
117137 filter , desc := BuildFilter (names , false , "" )
118138 assert .Contains (t , desc , "test" )
139+ assert .Contains (t , desc , "or" )
140+ assert .Contains (t , desc , "valid" )
119141
120142 container := new (mocks.FilterableContainer )
121143 container .On ("Name" ).Return ("Invalid" )
0 commit comments