mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
@@ -71,9 +71,33 @@ func TestSetTxtParse(t *testing.T) {
|
||||
t.Errorf("%v: expected TxtStrings=(%v) got (%v)", i, test.e2, ls)
|
||||
}
|
||||
for i := range ls {
|
||||
if len(ls[i]) != len(test.e2[i]) {
|
||||
if ls[i] != test.e2[i] {
|
||||
t.Errorf("%v: expected TxtStrings=(%v) got (%v)", i, test.e2, ls)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseQuotedFields(t *testing.T) {
|
||||
tests := []struct {
|
||||
d1 string
|
||||
e1 []string
|
||||
}{
|
||||
{`1 2 3`, []string{`1`, `2`, `3`}},
|
||||
{`1 "2" 3`, []string{`1`, `2`, `3`}},
|
||||
{`1 2 "three 3"`, []string{`1`, `2`, `three 3`}},
|
||||
{`0 issue "letsencrypt.org; validationmethods=dns-01; accounturi=https://acme-v02.api.letsencrypt.org/acme/acct/1234"`, []string{`0`, `issue`, `letsencrypt.org; validationmethods=dns-01; accounturi=https://acme-v02.api.letsencrypt.org/acme/acct/1234`}},
|
||||
}
|
||||
for i, test := range tests {
|
||||
ls, _ := ParseQuotedFields(test.d1)
|
||||
//fmt.Printf("%v: expected TxtStrings:\nWANT: %v\n GOT: %v\n", i, test.e1, ls)
|
||||
if len(ls) != len(test.e1) {
|
||||
t.Errorf("%v: expected TxtStrings=(%v) got (%v)", i, test.e1, ls)
|
||||
}
|
||||
for i := range ls {
|
||||
if ls[i] != test.e1[i] {
|
||||
t.Errorf("%v: expected TxtStrings=(%v) got (%v)", i, test.e1, ls)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user