@@ -11,77 +11,77 @@ func TestMatchNamespace(t *testing.T) {
1111
1212 // Empty debug string
1313 SetNamespace ("" )
14- assert .Equal (t , l .matchNamespace (), false , "they should be equal" )
14+ assert .False (t , l .matchNamespace (), "they should be equal" )
1515
1616 // Single wildcard
1717 SetNamespace ("*" )
18- assert .Equal (t , l .matchNamespace (), true , "they should be equal" )
18+ assert .True (t , l .matchNamespace (), "they should be equal" )
1919
2020 // Single negative pattern
2121 SetNamespace ("-test:*" )
22- assert .Equal (t , l .matchNamespace (), false , "they should be equal" )
22+ assert .False (t , l .matchNamespace (), "they should be equal" )
2323
2424 // Multiple negative patterns
2525 SetNamespace ("-test:a,-test:b" )
26- assert .Equal (t , l .matchNamespace (), false , "they should be equal" )
26+ assert .False (t , l .matchNamespace (), "they should be equal" )
2727
2828 // Leading/trailing spaces in debug string
2929 SetNamespace (" test:a " )
30- assert .Equal (t , l .matchNamespace (), true , "they should be equal" )
30+ assert .True (t , l .matchNamespace (), "they should be equal" )
3131
3232 // Overlapping inclusion and exclusion
3333 SetNamespace ("test:*, -test:a" )
34- assert .Equal (t , l .matchNamespace (), false , "they should be equal" )
34+ assert .False (t , l .matchNamespace (), "they should be equal" )
3535
3636 // Overlapping inclusion and exclusion
3737 SetNamespace ("*, -test:a" )
38- assert .Equal (t , l .matchNamespace (), false , "they should be equal" )
38+ assert .False (t , l .matchNamespace (), "they should be equal" )
3939
4040 // Overlapping inclusion and exclusion
4141 SetNamespace ("*, -test:?" )
42- assert .Equal (t , l .matchNamespace (), false , "they should be equal" )
42+ assert .False (t , l .matchNamespace (), "they should be equal" )
4343
4444 // Overlapping inclusion and exclusion
4545 SetNamespace ("*, -test:*" )
46- assert .Equal (t , l .matchNamespace (), false , "they should be equal" )
46+ assert .False (t , l .matchNamespace (), "they should be equal" )
4747
4848 // Exact match
4949 SetNamespace ("test:a" )
50- assert .Equal (t , l .matchNamespace (), true , "they should be equal" )
50+ assert .True (t , l .matchNamespace (), "they should be equal" )
5151
5252 // Case sensitivity
5353 SetNamespace ("TEST:A" )
54- assert .Equal (t , l .matchNamespace (), true , "they should be equal" ) // Assuming case-sensitive
54+ assert .True (t , l .matchNamespace (), "they should be equal" ) // Assuming case-sensitive
5555
5656 // No namespace provided
5757 l = New ("" )
5858 SetNamespace ("test:*" )
59- assert .Equal (t , l .matchNamespace (), false , "they should be equal" )
59+ assert .False (t , l .matchNamespace (), "they should be equal" )
6060
6161 // Non-matching wildcards
6262 SetNamespace ("test:x*" )
63- assert .Equal (t , l .matchNamespace (), false , "they should be equal" )
63+ assert .False (t , l .matchNamespace (), "they should be equal" )
6464
6565 // Invalid patterns
6666 SetNamespace ("--test:*" )
67- assert .Equal (t , l .matchNamespace (), false , "they should be equal" )
67+ assert .False (t , l .matchNamespace (), "they should be equal" )
6868
6969 // --- Optional pattern tests ---
7070 l = New ("info" )
7171 SetNamespace ("info:?" )
72- assert .Equal (t , l .matchNamespace (), true , "should match the base namespace" )
72+ assert .True (t , l .matchNamespace (), "should match the base namespace" )
7373
7474 l = New ("info:test" )
7575 SetNamespace ("info:?" )
76- assert .Equal (t , l .matchNamespace (), true , "should match the namespace with suffix" )
76+ assert .True (t , l .matchNamespace (), "should match the namespace with suffix" )
7777
7878 l = New ("info:test:sub" )
7979 SetNamespace ("info:?" )
80- assert .Equal (t , l .matchNamespace (), true , "should match namespace with deeper suffix" )
80+ assert .True (t , l .matchNamespace (), "should match namespace with deeper suffix" )
8181
8282 l = New ("other" )
8383 SetNamespace ("info:?" )
84- assert .Equal (t , l .matchNamespace (), false , "should not match unrelated namespace" )
84+ assert .False (t , l .matchNamespace (), "should not match unrelated namespace" )
8585}
8686
8787func TestMatchPattern (t * testing.T ) {
@@ -133,3 +133,10 @@ func TestMatchPattern(t *testing.T) {
133133 })
134134 }
135135}
136+
137+ func TestMatchpatterns (t * testing.T ) {
138+ ok := matchPattern ("namespace" , "[invalid" )
139+ assert .False (t , ok )
140+ ok = matchPattern ("namespace" , "[invalid:?" )
141+ assert .False (t , ok )
142+ }
0 commit comments