Changed test for lowercase tokens; improved code:
* for cases if $ORIGIN or $TTL are used in mixed case * changed test name too
This commit is contained in:
parent
d1ea8497ad
commit
476d122030
|
@ -764,7 +764,7 @@ func TestEmpty(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLowercaseClassOrType(t *testing.T) {
|
func TestLowercaseTockens(t *testing.T) {
|
||||||
var testrecords = []string{
|
var testrecords = []string{
|
||||||
"example.org. 300 IN a 1.2.3.4",
|
"example.org. 300 IN a 1.2.3.4",
|
||||||
"example.org. 300 in A 1.2.3.4",
|
"example.org. 300 in A 1.2.3.4",
|
||||||
|
@ -777,6 +777,9 @@ func TestLowercaseClassOrType(t *testing.T) {
|
||||||
"example.org. a 1.2.3.4",
|
"example.org. a 1.2.3.4",
|
||||||
"example.org. A 1.2.3.4",
|
"example.org. A 1.2.3.4",
|
||||||
"example.org. a 1.2.3.4",
|
"example.org. a 1.2.3.4",
|
||||||
|
"$ORIGIN example.org.\n a 1.2.3.4",
|
||||||
|
"$Origin example.org.\n a 1.2.3.4",
|
||||||
|
"$origin example.org.\n a 1.2.3.4",
|
||||||
}
|
}
|
||||||
for _, testrr := range testrecords {
|
for _, testrr := range testrecords {
|
||||||
_, err := NewRR(testrr)
|
_, err := NewRR(testrr)
|
||||||
|
|
3
zscan.go
3
zscan.go
|
@ -537,9 +537,10 @@ func zlexer(s *scan, c chan lex) {
|
||||||
// If we have a string and its the first, make it an owner
|
// If we have a string and its the first, make it an owner
|
||||||
l.value = _OWNER
|
l.value = _OWNER
|
||||||
l.token = string(str[:stri])
|
l.token = string(str[:stri])
|
||||||
|
l.tokenUpper = strings.ToUpper(l.token)
|
||||||
l.length = stri
|
l.length = stri
|
||||||
// escape $... start with a \ not a $, so this will work
|
// escape $... start with a \ not a $, so this will work
|
||||||
switch l.token {
|
switch l.tokenUpper {
|
||||||
case "$TTL":
|
case "$TTL":
|
||||||
l.value = _DIRTTL
|
l.value = _DIRTTL
|
||||||
case "$ORIGIN":
|
case "$ORIGIN":
|
||||||
|
|
Loading…
Reference in New Issue