2016-03-16 19:59:34 +00:00
|
|
|
package mtree
|
|
|
|
|
|
|
|
import (
|
2016-03-17 21:16:46 +00:00
|
|
|
"io/ioutil"
|
2016-03-16 19:59:34 +00:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestWalk(t *testing.T) {
|
2016-03-17 21:16:46 +00:00
|
|
|
dh, err := Walk(".", nil, append(DefaultKeywords, "sha1"))
|
2016-03-16 19:59:34 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
2016-03-17 21:16:46 +00:00
|
|
|
|
2016-03-18 20:30:54 +00:00
|
|
|
//log.Fatalf("%#v", dh)
|
2016-03-18 17:38:32 +00:00
|
|
|
|
2016-03-17 21:16:46 +00:00
|
|
|
fh, err := ioutil.TempFile("", "walk.")
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if _, err = dh.WriteTo(fh); err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
|
|
|
fh.Close()
|
|
|
|
t.Fatal(fh.Name())
|
|
|
|
//os.Remove(fh.Name())
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestReadNames(t *testing.T) {
|
|
|
|
names, err := readOrderedDirNames(".")
|
|
|
|
if err != nil {
|
2016-03-16 19:59:34 +00:00
|
|
|
t.Error(err)
|
|
|
|
}
|
2016-03-17 21:16:46 +00:00
|
|
|
t.Errorf("names: %q", names)
|
2016-03-16 19:59:34 +00:00
|
|
|
}
|