tests: remove parse_test.db

Make it an string inside the test file and use strings.NewReader.
This commit is contained in:
Miek Gieben 2014-10-06 07:45:31 +01:00
parent c12ae078ae
commit d05369e629
3 changed files with 11 additions and 14 deletions

View File

@ -1,6 +0,0 @@
a.example.com. IN A 127.0.0.1
8db7._openpgpkey.example.com. IN OPENPGPKEY mQCNAzIG
$ORIGIN a.example.com.
test IN A 127.0.0.1
$ORIGIN b.example.com.
test IN CNAME test.a.example.com.

View File

@ -7,7 +7,6 @@ import (
"fmt"
"math/rand"
"net"
"os"
"reflect"
"strconv"
"strings"
@ -563,13 +562,17 @@ func TestParseFailure(t *testing.T) {
}
func TestZoneParsing(t *testing.T) {
f, err := os.Open("parse_test.db")
if err != nil {
return
}
defer f.Close()
// parse_test.db
db := `
a.example.com. IN A 127.0.0.1
8db7._openpgpkey.example.com. IN OPENPGPKEY mQCNAzIG
$ORIGIN a.example.com.
test IN A 127.0.0.1
$ORIGIN b.example.com.
test IN CNAME test.a.example.com.
`
start := time.Now().UnixNano()
to := ParseZone(f, "", "parse_test.db")
to := ParseZone(strings.NewReader(db), "", "parse_test.db")
var i int
for x := range to {
i++

View File

@ -15,7 +15,7 @@ type ISBN struct {
func NewISBN() dns.PrivateRdata { return &ISBN{""} }
func (rd *ISBN) Len() int { return len([]byte(rd.x)) }
func (rd *ISBN) Len() int { return len([]byte(rd.x)) }
func (rd *ISBN) String() string { return rd.x }
func (rd *ISBN) Parse(txt []string) error {