Make IsDNS1123Subdomain return error strings

This commit is contained in:
Tim Hockin
2015-12-16 21:58:09 -08:00
parent 77eff06a53
commit 5862a60ae7
6 changed files with 29 additions and 19 deletions

View File

@@ -60,8 +60,8 @@ func TestIsDNS1123Subdomain(t *testing.T) {
strings.Repeat("a", 253),
}
for _, val := range goodValues {
if !IsDNS1123Subdomain(val) {
t.Errorf("expected true for '%s'", val)
if msgs := IsDNS1123Subdomain(val); len(msgs) != 0 {
t.Errorf("expected true for '%s': %v", val, msgs)
}
}
@@ -80,7 +80,7 @@ func TestIsDNS1123Subdomain(t *testing.T) {
strings.Repeat("a", 254),
}
for _, val := range badValues {
if IsDNS1123Subdomain(val) {
if msgs := IsDNS1123Subdomain(val); len(msgs) == 0 {
t.Errorf("expected false for '%s'", val)
}
}