|
|
|
|
@ -33,6 +33,24 @@ func TestInterpolationWalker_detect(t *testing.T) {
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
Input: map[string]interface{}{
|
|
|
|
|
"foo": "${lookup(var.foo)}",
|
|
|
|
|
},
|
|
|
|
|
Result: []Interpolation{
|
|
|
|
|
&FunctionInterpolation{
|
|
|
|
|
Func: nil,
|
|
|
|
|
Args: []InterpolatedVariable{
|
|
|
|
|
&UserVariable{
|
|
|
|
|
Name: "foo",
|
|
|
|
|
key: "var.foo",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
key: "lookup(var.foo)",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for i, tc := range cases {
|
|
|
|
|
@ -48,6 +66,14 @@ func TestInterpolationWalker_detect(t *testing.T) {
|
|
|
|
|
t.Fatalf("err: %s", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, a := range actual {
|
|
|
|
|
// This is jank, but reflect.DeepEqual never has functions
|
|
|
|
|
// being the same.
|
|
|
|
|
if f, ok := a.(*FunctionInterpolation); ok {
|
|
|
|
|
f.Func = nil
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if !reflect.DeepEqual(actual, tc.Result) {
|
|
|
|
|
t.Fatalf("%d: bad:\n\n%#v", i, actual)
|
|
|
|
|
}
|
|
|
|
|
|