cleanup and extra test

This commit is contained in:
Miek Gieben 2012-05-20 15:31:35 +02:00
parent 7a3af5b729
commit 9c67491aee
2 changed files with 10 additions and 6 deletions

View File

@ -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 {

View File

@ -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.