Return an error if node to be updated is not a scalar

This commit is contained in:
Stefan Haller
2023-06-08 09:00:31 +02:00
parent 221433522d
commit 7fb86d6e9c
2 changed files with 18 additions and 5 deletions

View File

@@ -66,6 +66,14 @@ func TestUpdateYamlValue(t *testing.T) {
expectedOut: "42\n",
expectedErr: "yaml document is not a dictionary",
},
{
name: "trying to update a note that is not a scalar",
in: "foo: [1, 2, 3]\n",
path: []string{"foo"},
value: "bar",
expectedOut: "foo: [1, 2, 3]\n",
expectedErr: "yaml node is not a scalar",
},
}
for _, test := range tests {