9 // TestTree loads a module at the given path and returns the tree as well
10 // as a function that should be deferred to clean up resources.
11 func TestTree(t *testing.T, path string) (*Tree, func()) {
12 // Create a temporary directory for module storage
13 dir, err := ioutil.TempDir("", "tf")
15 t.Fatalf("err: %s", err)
20 mod, err := NewTreeModule("", path)
22 t.Fatalf("err: %s", err)
26 // Get the child modules
27 s := &Storage{StorageDir: dir, Mode: GetModeGet}
28 if err := mod.Load(s); err != nil {
29 t.Fatalf("err: %s", err)