fix errror message using replacement wildcard and create option

This commit is contained in:
koba1t
2022-04-12 05:14:24 +09:00
parent e5041bae6f
commit 5e84de2a89
4 changed files with 51 additions and 5 deletions

View File

@@ -142,7 +142,7 @@ func TestElementSetter(t *testing.T) {
node = MustParse(`
- a: b
- c: d
- c: d
`)
// If given a key and no values, ElementSetter will
// change node to be an empty list
@@ -154,7 +154,7 @@ func TestElementSetter(t *testing.T) {
node = MustParse(`
- a: b
- c: d
- c: d
`)
// Return error because ElementSetter will assume all elements are scalar when
// there is only value provided.
@@ -580,6 +580,13 @@ a: {}
assert.Equal(t, "h\n", assertNoErrorString(t)(rn.String()))
}
func TestLookup_Fn_create_with_wildcard_error(t *testing.T) {
node, err := Parse(s)
assert.NoError(t, err)
_, err = node.Pipe(LookupCreate(yaml.MappingNode, "a", "b", "*", "t"))
assert.Error(t, err, "cannot support create option in a multi-value target now")
}
func TestLookup(t *testing.T) {
s := `n: o
a: