Add Class parsing test function
This commit is contained in:
parent
09c28d4a95
commit
fc67c4b981
|
@ -430,6 +430,31 @@ func TestQuotes(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestParseClass(t *testing.T) {
|
||||||
|
tests := map[string]string{
|
||||||
|
"t.example.com. IN A 127.0.0.1": "t.example.com. 3600 IN A 127.0.0.1",
|
||||||
|
"t.example.com. CS A 127.0.0.1": "t.example.com. 3600 CS A 127.0.0.1",
|
||||||
|
"t.example.com. CH A 127.0.0.1": "t.example.com. 3600 CH A 127.0.0.1",
|
||||||
|
// ClassANY can not occur in zone files
|
||||||
|
// "t.example.com. ANY A 127.0.0.1": "t.example.com. 3600 ANY A 127.0.0.1",
|
||||||
|
"t.example.com. NONE A 127.0.0.1": "t.example.com. 3600 NONE A 127.0.0.1",
|
||||||
|
}
|
||||||
|
for i, o := range tests {
|
||||||
|
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\n`%s'\n", i, o, rr.String())
|
||||||
|
t.Fail()
|
||||||
|
} else {
|
||||||
|
t.Logf("RR is OK: `%s'", rr.String())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestBrace(t *testing.T) {
|
func TestBrace(t *testing.T) {
|
||||||
tests := map[string]string{
|
tests := map[string]string{
|
||||||
"(miek.nl.) 3600 IN A 127.0.1.1": "miek.nl.\t3600\tIN\tA\t127.0.1.1",
|
"(miek.nl.) 3600 IN A 127.0.1.1": "miek.nl.\t3600\tIN\tA\t127.0.1.1",
|
||||||
|
|
Loading…
Reference in New Issue