From 537fa6cc872fb812aea637b88f247b93c75fec10 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 23 May 2014 22:12:48 -0700 Subject: [PATCH] config: more tests for variable detector --- config/variable_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/config/variable_test.go b/config/variable_test.go index c8b763405e..a7f11e9f8c 100644 --- a/config/variable_test.go +++ b/config/variable_test.go @@ -32,6 +32,22 @@ func TestVariableDetectWalker(t *testing.T) { } } +func TestVariableDetectWalker_resource(t *testing.T) { + w := new(variableDetectWalker) + + str := `foo ${ec2.foo.bar}` + if err := w.Primitive(reflect.ValueOf(str)); err != nil { + t.Fatalf("err: %s", err) + } + + if len(w.Variables) != 1 { + t.Fatalf("bad: %#v", w.Variables) + } + if w.Variables["ec2.foo.bar"].(*ResourceVariable).FullKey() != "ec2.foo.bar" { + t.Fatalf("bad: %#v", w.Variables) + } +} + func TestVariableDetectWalker_bad(t *testing.T) { w := new(variableDetectWalker)