2016-03-10 21:15:55 +00:00
|
|
|
package mtree
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
var testFiles = []string{
|
|
|
|
"testdata/source.mtree",
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestParser(t *testing.T) {
|
|
|
|
for _, file := range testFiles {
|
|
|
|
func() {
|
|
|
|
fh, err := os.Open(file)
|
|
|
|
if err != nil {
|
2016-03-11 20:53:20 +00:00
|
|
|
t.Error(err)
|
2016-03-10 21:15:55 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
defer fh.Close()
|
|
|
|
|
2016-03-11 20:53:20 +00:00
|
|
|
dh, err := ParseSpec(fh)
|
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
2016-03-10 21:15:55 +00:00
|
|
|
}
|
2016-03-11 20:53:20 +00:00
|
|
|
fmt.Printf("%q", dh)
|
|
|
|
|
|
|
|
_, err = dh.WriteTo(os.Stdout)
|
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
2016-03-10 21:15:55 +00:00
|
|
|
}
|
2016-03-11 20:53:20 +00:00
|
|
|
|
2016-03-10 21:15:55 +00:00
|
|
|
}()
|
|
|
|
}
|
|
|
|
}
|