}{
{
"xmpp-server", "tcp", "google.com",
- "google.com", "google.com",
+ "google.com.", "google.com.",
},
{
"xmpp-server", "tcp", "google.com.",
- "google.com", "google.com",
+ "google.com.", "google.com.",
},
// non-standard back door
{
"", "", "_xmpp-server._tcp.google.com",
- "google.com", "google.com",
+ "google.com.", "google.com.",
},
{
"", "", "_xmpp-server._tcp.google.com.",
- "google.com", "google.com",
+ "google.com.", "google.com.",
},
}
if len(srvs) == 0 {
t.Error("got no record")
}
- if !strings.HasSuffix(cname, tt.cname) && !strings.HasSuffix(cname, tt.cname+".") {
+ if !strings.HasSuffix(cname, tt.cname) {
t.Errorf("got %s; want %s", cname, tt.cname)
}
for _, srv := range srvs {
- if !strings.HasSuffix(srv.Target, tt.target) && !strings.HasSuffix(srv.Target, tt.target+".") {
+ if !strings.HasSuffix(srv.Target, tt.target) {
t.Errorf("got %v; want a record containing %s", srv, tt.target)
}
}
var lookupGmailMXTests = []struct {
name, host string
}{
- {"gmail.com", "google.com"},
- {"gmail.com.", "google.com"},
+ {"gmail.com", "google.com."},
+ {"gmail.com.", "google.com."},
}
func TestLookupGmailMX(t *testing.T) {
t.Error("got no record")
}
for _, mx := range mxs {
- if !strings.HasSuffix(mx.Host, tt.host) && !strings.HasSuffix(mx.Host, tt.host+".") {
+ if !strings.HasSuffix(mx.Host, tt.host) {
t.Errorf("got %v; want a record containing %s", mx, tt.host)
}
}
var lookupGmailNSTests = []struct {
name, host string
}{
- {"gmail.com", "google.com"},
- {"gmail.com.", "google.com"},
+ {"gmail.com", "google.com."},
+ {"gmail.com.", "google.com."},
}
func TestLookupGmailNS(t *testing.T) {
t.Error("got no record")
}
for _, ns := range nss {
- if !strings.HasSuffix(ns.Host, tt.host) && !strings.HasSuffix(ns.Host, tt.host+".") {
+ if !strings.HasSuffix(ns.Host, tt.host) {
t.Errorf("got %v; want a record containing %s", ns, tt.host)
}
}
var lookupGooglePublicDNSAddrTests = []struct {
addr, name string
}{
- {"8.8.8.8", ".google.com"},
- {"8.8.4.4", ".google.com"},
- {"2001:4860:4860::8888", ".google.com"},
- {"2001:4860:4860::8844", ".google.com"},
+ {"8.8.8.8", ".google.com."},
+ {"8.8.4.4", ".google.com."},
+
+ {"2001:4860:4860::8888", ".google.com."},
+ {"2001:4860:4860::8844", ".google.com."},
}
func TestLookupGooglePublicDNSAddr(t *testing.T) {
t.Error("got no record")
}
for _, name := range names {
- if !strings.HasSuffix(name, tt.name) && !strings.HasSuffix(name, tt.name+".") {
+ if !strings.HasSuffix(name, tt.name) {
t.Errorf("got %s; want a record containing %s", name, tt.name)
}
}
var lookupIANACNAMETests = []struct {
name, cname string
}{
- {"www.iana.org", "icann.org"},
- {"www.iana.org.", "icann.org"},
+ {"www.iana.org", "icann.org."},
+ {"www.iana.org.", "icann.org."},
}
func TestLookupIANACNAME(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- if !strings.HasSuffix(cname, tt.cname) && !strings.HasSuffix(cname, tt.cname+".") {
+ if !strings.HasSuffix(cname, tt.cname) {
t.Errorf("got %s; want a record containing %s", cname, tt.cname)
}
}