mirror of
https://github.com/vbatts/go-mtree.git
synced 2024-11-28 19:15:40 +00:00
walk: test passes and validates parse
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
9c6b4257f4
commit
99dcd25a7e
1 changed files with 15 additions and 13 deletions
28
walk_test.go
28
walk_test.go
|
@ -2,6 +2,7 @@ package mtree
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -10,26 +11,27 @@ func TestWalk(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
numEntries = countTypes(dh)
|
||||||
//log.Fatalf("%#v", dh)
|
|
||||||
|
|
||||||
fh, err := ioutil.TempFile("", "walk.")
|
fh, err := ioutil.TempFile("", "walk.")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
defer os.Remove(fh.Name())
|
||||||
|
defer fh.Close()
|
||||||
|
|
||||||
if _, err = dh.WriteTo(fh); err != nil {
|
if _, err = dh.WriteTo(fh); err != nil {
|
||||||
t.Error(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
fh.Close()
|
if _, err := fh.Seek(0, 0); err != nil {
|
||||||
t.Fatal(fh.Name())
|
t.Fatal(err)
|
||||||
//os.Remove(fh.Name())
|
}
|
||||||
}
|
if dh, err = ParseSpec(fh); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
func TestReadNames(t *testing.T) {
|
}
|
||||||
names, err := readOrderedDirNames(".")
|
for k, v := range countTypes(dh) {
|
||||||
if err != nil {
|
if numEntries[k] != v {
|
||||||
t.Error(err)
|
t.Errorf("for type %s: expected %d, got %d", k, numEntries[k], v)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
t.Errorf("names: %q", names)
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue