From 03c7b546689bd025a7cefbef462ba2bf18177dd9 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Wed, 16 Jan 2013 11:48:43 +0100 Subject: [PATCH 1/2] Add parse test for DS record --- parse_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/parse_test.go b/parse_test.go index 24fe506b..b5574d23 100644 --- a/parse_test.go +++ b/parse_test.go @@ -274,6 +274,28 @@ func TestParseLOC(t *testing.T) { } } +func TestParseDS(t *testing.T) { + dt := map[string]string{ + "example.net. 3600 IN DS 40692 12 3 22261A8B0E0D799183E35E24E2AD6BB58533CBA7E3B14D659E9CA09B 2071398F": + "example.net.\t3600\tIN\tDS\t40692 12 3 22261A8B0E0D799183E35E24E2AD6BB58533CBA7E3B14D659E9CA09B2071398F", + } + for i, o := range dt { + rr, e := NewRR(i) + if e != nil { + t.Log("Failed to parse RR: " + e.Error()) + t.Fail() + continue + } + if rr.String() != o { + t.Logf("`%s' should be equal to\n`%s', but is `%s'\n", i, o, rr.String()) + t.Fail() + } else { + t.Logf("RR is OK: `%s'", rr.String()) + } + } +} + + func TestQuotes(t *testing.T) { tests := map[string]string{ `t.example.com. IN TXT "a bc"`: "t.example.com.\t3600\tIN\tTXT\t\"a bc\"", From ed1bb58a6606bfe1fbdc3739b33317bf7fb4de62 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Thu, 17 Jan 2013 11:16:22 +0100 Subject: [PATCH 2/2] typo in doc --- zscan_rr.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zscan_rr.go b/zscan_rr.go index 3a570826..fe5c64fd 100644 --- a/zscan_rr.go +++ b/zscan_rr.go @@ -9,7 +9,7 @@ import ( // Parse the rdata of each rrtype. // All data from the channel c is either _STRING or _BLANK. -// After the rdata there may come 1 _BLANK and then a _NEWLINE +// After the rdata there may come a _BLANK and then a _NEWLINE // or immediately a _NEWLINE. If this is not the case we flag // an *ParseError: garbage after rdata. func setRR(h RR_Header, c chan lex, o, f string) (RR, *ParseError) {