Test that the coalesced key is properly removed for all YAML null syntax options, but not for empty string

pull/2648/head
Scott Rigby 8 years ago
parent 645f01eb22
commit 6dc31f8e96

@ -2,3 +2,8 @@ scope: moby
name: moby
override: bad
top: nope
bottom: exists
right: exists
left: exists
front: exists
back: exists

@ -277,6 +277,11 @@ func ttpl(tpl string, v map[string]interface{}) (string, error) {
var testCoalesceValuesYaml = `
top: yup
bottom: null
right: Null
left: NULL
front: ~
back: ""
global:
name: Ishmael
@ -316,6 +321,7 @@ func TestCoalesceValues(t *testing.T) {
expect string
}{
{"{{.top}}", "yup"},
{"{{.back}}", ""},
{"{{.name}}", "moby"},
{"{{.global.name}}", "Ishmael"},
{"{{.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)
}
}
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) {

Loading…
Cancel
Save