Return an error if document is not a dictionary

This commit is contained in:
Stefan Haller
2023-06-08 08:45:07 +02:00
parent 90084d115e
commit 221433522d
2 changed files with 15 additions and 0 deletions

View File

@@ -56,6 +56,16 @@ func TestUpdateYamlValue(t *testing.T) {
expectedOut: "foo:\n bar: qux\n",
expectedErr: "",
},
// Error cases
{
name: "existing document is not a dictionary",
in: "42\n",
path: []string{"foo"},
value: "bar",
expectedOut: "42\n",
expectedErr: "yaml document is not a dictionary",
},
}
for _, test := range tests {