20 lines
547 B
Go
20 lines
547 B
Go
package checker
|
|
|
|
import "testing"
|
|
|
|
func TestRRsetKey(t *testing.T) {
|
|
cases := []struct {
|
|
name, typ, want string
|
|
}{
|
|
{"example.com", "A", "example.com./A"},
|
|
{"example.com.", "A", "example.com./A"},
|
|
{"WWW.Example.Com", "AAAA", "WWW.Example.Com./AAAA"}, // case is preserved (Fqdn doesn't downcase)
|
|
{".", "SOA", "./SOA"},
|
|
{"sub.example.com", "MX", "sub.example.com./MX"},
|
|
}
|
|
for _, c := range cases {
|
|
if got := rrsetKey(c.name, c.typ); got != c.want {
|
|
t.Errorf("rrsetKey(%q,%q) = %q, want %q", c.name, c.typ, got, c.want)
|
|
}
|
|
}
|
|
}
|