From 501e858f679edecd4a38a86317ce50271014a80d Mon Sep 17 00:00:00 2001 From: tr3e <807596654@qq.com> Date: Sun, 23 Sep 2018 01:36:01 +0800 Subject: [PATCH] Fix issue #742 (#745) * Fix error comparison in SetTA * Add testcase TestParseTA() --- scan_rr.go | 6 +++--- scan_test.go | 10 ++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/scan_rr.go b/scan_rr.go index e9556282d..67f884b0d 100644 --- a/scan_rr.go +++ b/scan_rr.go @@ -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 diff --git a/scan_test.go b/scan_test.go index 88baa602c..c4449d9ba 100644 --- a/scan_test.go +++ b/scan_test.go @@ -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`) + } +}