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:
Alex Sergeyev 2014-08-28 08:17:40 -04:00
parent d1ea8497ad
commit 476d122030
2 changed files with 6 additions and 2 deletions

View File

@ -764,7 +764,7 @@ func TestEmpty(t *testing.T) {
}
}
func TestLowercaseClassOrType(t *testing.T) {
func TestLowercaseTockens(t *testing.T) {
var testrecords = []string{
"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",
"$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 {
_, err := NewRR(testrr)

View File

@ -537,9 +537,10 @@ func zlexer(s *scan, c chan lex) {
// If we have a string and its the first, make it an owner
l.value = _OWNER
l.token = string(str[:stri])
l.tokenUpper = strings.ToUpper(l.token)
l.length = stri
// escape $... start with a \ not a $, so this will work
switch l.token {
switch l.tokenUpper {
case "$TTL":
l.value = _DIRTTL
case "$ORIGIN":