* Fix error comparison in SetTA

* Add testcase TestParseTA()
This commit is contained in:
tr3e 2018-09-23 01:36:01 +08:00 committed by Miek Gieben
parent 833bf76c28
commit 501e858f67
2 changed files with 13 additions and 3 deletions

View File

@ -1665,9 +1665,9 @@ func setTA(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
return nil, &ParseError{f, "bad TA DigestType", l}, ""
}
rr.DigestType = uint8(i)
s, e, c1 := endingToString(c, "bad TA Digest", f)
if e != nil {
return nil, e.(*ParseError), c1
s, err, c1 := endingToString(c, "bad TA Digest", f)
if err != nil {
return nil, err, c1
}
rr.Digest = s
return rr, nil, c1

View File

@ -79,3 +79,13 @@ func TestParseZoneInclude(t *testing.T) {
}
}
}
func TestParseTA(t *testing.T) {
rr, err := NewRR(` Ta 0 0 0`)
if err != nil {
t.Fatalf("expected no error, but got %s", err)
}
if rr == nil {
t.Fatal(`expected a normal RR, but got nil`)
}
}