Adding another xml test; spelling fixes

This commit is contained in:
Mike Farah
2023-09-26 14:43:08 +10:00
parent 05ad1dad90
commit 0cf3adf5dd
10 changed files with 38 additions and 19 deletions
+7
View File
@@ -363,6 +363,13 @@ var xmlScenarios = []formatScenario{
expression: ".zoo.animal |= ([] + .)",
expected: "zoo:\n animal:\n - cat\n",
},
{
description: "Parse xml: force all as an array",
subdescription: "Because of the way yq works, when updating everything you need to update the children before the parents. By default `..` will match parents first, so we reverse that before updating.",
input: "<zoo><thing><frog>boing</frog></thing></zoo>",
expression: "([..] | reverse | .[]) |= [] + .",
expected: "- zoo:\n - thing:\n - frog:\n - boing\n",
},
{
description: "Parse xml: attributes",
subdescription: "Attributes are converted to fields, with the default attribute prefix '+'. Use '--xml-attribute-prefix` to set your own.",