diff --git a/acceptance_tests/inputs-format.sh b/acceptance_tests/inputs-format.sh index 2173678e..8979d04d 100755 --- a/acceptance_tests/inputs-format.sh +++ b/acceptance_tests/inputs-format.sh @@ -127,6 +127,7 @@ testInputXmlNamespaces() { EOL read -r -d '' expected << EOM ++p_xml: version="1.0" map: +xmlns: some-namespace +xmlns:xsi: some-instance @@ -140,6 +141,26 @@ EOM assertEquals "$expected" "$X" } +testInputXmlRoundtrip() { + cat >test.yml < + +Meow +EOL + + read -r -d '' expected << EOM + + +Meow +EOM + + X=$(./yq -p=xml -o=xml test.yml) + assertEquals "$expected" "$X" + + X=$(./yq ea -p=xml -o=xml test.yml) + assertEquals "$expected" "$X" +} + testInputXmlStrict() { cat >test.yml < EOL - X=$(./yq -p=xml --xml-strict-mode test.yml 2>&1) + X=$(./yq -p=xml --xml-strict-mode test.yml -o=xml 2>&1) assertEquals 1 $? assertEquals "Error: bad file 'test.yml': XML syntax error on line 7: invalid character entity &writer;" "$X" - X=$(./yq ea -p=xml --xml-strict-mode test.yml 2>&1) + X=$(./yq ea -p=xml --xml-strict-mode test.yml -o=xml 2>&1) assertEquals "Error: bad file 'test.yml': XML syntax error on line 7: invalid character entity &writer;" "$X" }