|
|
@ -277,6 +277,11 @@ func ttpl(tpl string, v map[string]interface{}) (string, error) {
|
|
|
|
|
|
|
|
|
|
|
|
var testCoalesceValuesYaml = `
|
|
|
|
var testCoalesceValuesYaml = `
|
|
|
|
top: yup
|
|
|
|
top: yup
|
|
|
|
|
|
|
|
bottom: null
|
|
|
|
|
|
|
|
right: Null
|
|
|
|
|
|
|
|
left: NULL
|
|
|
|
|
|
|
|
front: ~
|
|
|
|
|
|
|
|
back: ""
|
|
|
|
|
|
|
|
|
|
|
|
global:
|
|
|
|
global:
|
|
|
|
name: Ishmael
|
|
|
|
name: Ishmael
|
|
|
@ -316,6 +321,7 @@ func TestCoalesceValues(t *testing.T) {
|
|
|
|
expect string
|
|
|
|
expect string
|
|
|
|
}{
|
|
|
|
}{
|
|
|
|
{"{{.top}}", "yup"},
|
|
|
|
{"{{.top}}", "yup"},
|
|
|
|
|
|
|
|
{"{{.back}}", ""},
|
|
|
|
{"{{.name}}", "moby"},
|
|
|
|
{"{{.name}}", "moby"},
|
|
|
|
{"{{.global.name}}", "Ishmael"},
|
|
|
|
{"{{.global.name}}", "Ishmael"},
|
|
|
|
{"{{.global.subject}}", "Queequeg"},
|
|
|
|
{"{{.global.subject}}", "Queequeg"},
|
|
|
@ -343,6 +349,13 @@ func TestCoalesceValues(t *testing.T) {
|
|
|
|
t.Errorf("Expected %q to expand to %q, got %q", tt.tpl, tt.expect, o)
|
|
|
|
t.Errorf("Expected %q to expand to %q, got %q", tt.tpl, tt.expect, o)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nullKeys := []string{"bottom", "right", "left", "front"}
|
|
|
|
|
|
|
|
for _, nullKey := range nullKeys {
|
|
|
|
|
|
|
|
if _, ok := v[nullKey]; ok {
|
|
|
|
|
|
|
|
t.Errorf("Expected key %q to be removed, still present", nullKey)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func TestCoalesceTables(t *testing.T) {
|
|
|
|
func TestCoalesceTables(t *testing.T) {
|
|
|
|