mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
moving a bunch of packages under pkg (#124)
* moving a bunch of packages under pkg * fix gen * fix tst * oops * fix test fo real * parse mx/a
This commit is contained in:
31
pkg/dnsresolver/dnscache_test.go
Normal file
31
pkg/dnsresolver/dnscache_test.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package dnsresolver
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestDnsCache(t *testing.T) {
|
||||
|
||||
cache := &dnsCache{}
|
||||
cache.put("one", "txt", []string{"a", "b", "c"})
|
||||
cache.put("two", "txt", []string{"d", "e", "f"})
|
||||
|
||||
a, b := cache.get("one", "txt")
|
||||
if !(b == true && len(a) == 3 && a[0] == "a" && a[1] == "b" && a[2] == "c") {
|
||||
t.Errorf("one-txt didn't work")
|
||||
}
|
||||
|
||||
a, b = cache.get("two", "txt")
|
||||
if !(b == true && len(a) == 3 && a[0] == "d" && a[1] == "e" && a[2] == "f") {
|
||||
t.Errorf("one-txt didn't work")
|
||||
}
|
||||
|
||||
a, b = cache.get("three", "txt")
|
||||
if !(b == false) {
|
||||
t.Errorf("three-txt didn't work")
|
||||
}
|
||||
|
||||
a, b = cache.get("two", "not")
|
||||
if !(b == false) {
|
||||
t.Errorf("two-not didn't work")
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user