Fix deleting commented empty list YAML output (#2765)

This commit is contained in:
Dustin Persek
2026-08-03 13:20:19 +10:00
committed by GitHub
parent 2fbc2eab20
commit b74aefd55f
2 changed files with 37 additions and 0 deletions
+13
View File
@@ -119,6 +119,19 @@ var deleteOperatorScenarios = []expressionScenario{
"D0, P[], (!!map)::a: []\n",
},
},
{
skipDoc: true,
description: "Delete all entries from list with inline key comment",
document: `testList: # A comment
- name: test1
value: 123
- name: test2
value: 456`,
expression: `del(.testList[])`,
expected: []string{
"D0, P[], (!!map)::testList: [] # A comment\n",
},
},
{
skipDoc: true,
description: "Delete entry appended to an array",