mirror of
https://github.com/vbatts/go-mtree.git
synced 2024-11-05 08:25:58 +00:00
Vincent Batts
3b6cb6e117
Setting up sibling and parent relationships for entries, so they can be easier to walk. Also, making "keyword=value" easier to parse. This helps filtering. Both of these ready us for checking/validating a hierarchy. Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
36 lines
546 B
Go
36 lines
546 B
Go
package mtree
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"log"
|
|
"testing"
|
|
)
|
|
|
|
func TestWalk(t *testing.T) {
|
|
dh, err := Walk(".", nil, append(DefaultKeywords, "sha1"))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
log.Fatalf("%#v", dh)
|
|
|
|
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 {
|
|
t.Error(err)
|
|
}
|
|
t.Errorf("names: %q", names)
|
|
}
|