diff --git a/parse_test.go b/parse_test.go index d2ec6762..a267c598 100644 --- a/parse_test.go +++ b/parse_test.go @@ -554,8 +554,15 @@ func TestRfc1982(t *testing.T) { } } +func TestEmpty(t *testing.T) { + for _ = range ParseZone(strings.NewReader(""), "", "") { + t.Logf("Should be empty") + t.Fail() + } +} + func TestGenerate(t *testing.T) { - zone := "$GENERATE 65-126 $ 1D AAAA $.64/26" + zone := "$GENERATE 65-126 $ 1D CNAME $.64/26" to := ParseZone(strings.NewReader(zone), "miek.nl.", "") for x := range to { if x.Error == nil { diff --git a/zscan.go b/zscan.go index 338dbd2a..e5ee0e35 100644 --- a/zscan.go +++ b/zscan.go @@ -424,11 +424,8 @@ func parseZone(r io.Reader, origin, f string, t chan Token, include int) { st = _EXPECT_OWNER_DIR } } - // If we get here, we and the h.Rrtype is still zero, we haven't parsed anything - // Empty zonefile is also still zone file - // if h.Rrtype == 0 { - // t <- Token{Error: &ParseError{f, "nothing made sense", lex{}}} - // } + // If we get here, we and the h.Rrtype is still zero, we haven't parsed anything, this + // is not an error, because an empty zone file is still a zone file. } // zlexer scans the sourcefile and returns tokens on the channel c.