Fix(domain-trie): domain could without dot

This commit is contained in:
Dreamacro
2019-07-16 00:57:08 +08:00
parent 3497fdaf45
commit 9e77c650d9
2 changed files with 17 additions and 5 deletions

View File

@ -65,11 +65,19 @@ func TestTrie_Boundary(t *testing.T) {
tree := New()
tree.Insert("*.dev", localIP)
if err := tree.Insert("com", localIP); err == nil {
if err := tree.Insert(".", localIP); err == nil {
t.Error("should recv err")
}
if err := tree.Insert(".com", localIP); err == nil {
t.Error("should recv err")
}
if tree.Search("dev") != nil {
t.Error("should recv nil")
}
if tree.Search(".dev") != nil {
t.Error("should recv nil")
}
}