config/module: failing unit test for GH-1232

This commit is contained in:
Mitchell Hashimoto 2015-03-26 09:11:32 -07:00
parent 19c7f8cff4
commit bd4aaac71a
4 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,3 @@
module "b" {
source = "../c"
}

View File

@ -0,0 +1 @@
# Hello

View File

@ -0,0 +1,3 @@
module "a" {
source = "./a"
}

View File

@ -94,6 +94,44 @@ func TestTreeLoad_duplicate(t *testing.T) {
}
}
func TestTreeLoad_parentRef(t *testing.T) {
storage := testStorage(t)
tree := NewTree("", testConfig(t, "basic-parent"))
if tree.Loaded() {
t.Fatal("should not be loaded")
}
// This should error because we haven't gotten things yet
if err := tree.Load(storage, GetModeNone); err == nil {
t.Fatal("should error")
}
if tree.Loaded() {
t.Fatal("should not be loaded")
}
// This should get things
if err := tree.Load(storage, GetModeGet); err != nil {
t.Fatalf("err: %s", err)
}
if !tree.Loaded() {
t.Fatal("should be loaded")
}
// This should no longer error
if err := tree.Load(storage, GetModeNone); err != nil {
t.Fatalf("err: %s", err)
}
actual := strings.TrimSpace(tree.String())
expected := strings.TrimSpace(treeLoadStr)
if actual != expected {
t.Fatalf("bad: \n\n%s", actual)
}
}
func TestTreeLoad_subdir(t *testing.T) {
storage := testStorage(t)
tree := NewTree("", testConfig(t, "basic-subdir"))