chore: add test case

This commit is contained in:
Skyxim 2023-04-01 11:21:38 +08:00
parent f54bf2d935
commit d4e48d709f

View File

@ -43,6 +43,7 @@ func TestDomainWildcard(t *testing.T) {
domainSet := []string{ domainSet := []string{
"*.*.*.baidu.com", "*.*.*.baidu.com",
"www.baidu.*", "www.baidu.*",
"stun.*.*",
"*.*.qq.com", "*.*.qq.com",
"test.*.baidu.com", "test.*.baidu.com",
} }
@ -51,7 +52,9 @@ func TestDomainWildcard(t *testing.T) {
assert.True(t, set.Has("www.baidu.com")) assert.True(t, set.Has("www.baidu.com"))
assert.True(t, set.Has("test.test.baidu.com")) assert.True(t, set.Has("test.test.baidu.com"))
assert.True(t, set.Has("test.test.qq.com")) assert.True(t, set.Has("test.test.qq.com"))
assert.True(t,set.Has("stun.ab.cd"))
assert.False(t, set.Has("test.baidu.com")) assert.False(t, set.Has("test.baidu.com"))
assert.False(t,set.Has("www.google.com"))
assert.False(t, set.Has("test.qq.com")) assert.False(t, set.Has("test.qq.com"))
assert.False(t, set.Has("test.test.test.qq.com")) assert.False(t, set.Has("test.test.test.qq.com"))
} }