XmlWriter reverts to XML 1.0.

Character encodings that are not valid in XML 1.0 are instead written using C-style escapes
This commit is contained in:
Phil Nash
2017-02-06 16:00:05 +00:00
parent 7db4d8d90c
commit 1f271c9944
5 changed files with 36 additions and 40 deletions

View File

@@ -8106,9 +8106,9 @@ MiscTests.cpp:<line number>
MiscTests.cpp:<line number>:
PASSED:
REQUIRE( encode( "[\x01]" ) == "[&#x01;]" )
REQUIRE( encode( "[\x01]" ) == "[\\x01]" )
with expansion:
"[&#x01;]" == "[&#x01;]"
"[\x01]" == "[\x01]"
-------------------------------------------------------------------------------
XmlEncode
@@ -8119,9 +8119,9 @@ MiscTests.cpp:<line number>
MiscTests.cpp:<line number>:
PASSED:
REQUIRE( encode( "[\x7F]" ) == "[&#x7F;]" )
REQUIRE( encode( "[\x7F]" ) == "[\\x7F]" )
with expansion:
"[&#x7F;]" == "[&#x7F;]"
"[\x7F]" == "[\x7F]"
-------------------------------------------------------------------------------
atomic if

View File

@@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="<exe-name>" errors="13" failures="68" tests="931" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<testcase classname="global" name="# A test name that starts with a #" time="{duration}"/>

View File

@@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<Catch name="<exe-name>">
<Group name="<exe-name>">
<TestCase name="# A test name that starts with a #">
@@ -8600,10 +8600,10 @@ there"
<Section name="string with control char (1)">
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MiscTests.cpp" >
<Original>
encode( "[\x01]" ) == "[&amp;#x01;]"
encode( "[\x01]" ) == "[\\x01]"
</Original>
<Expanded>
"[&amp;#x01;]" == "[&amp;#x01;]"
"[\x01]" == "[\x01]"
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0"/>
@@ -8611,10 +8611,10 @@ there"
<Section name="string with control char (x7F)">
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MiscTests.cpp" >
<Original>
encode( "[\x7F]" ) == "[&amp;#x7F;]"
encode( "[\x7F]" ) == "[\\x7F]"
</Original>
<Expanded>
"[&amp;#x7F;]" == "[&amp;#x7F;]"
"[\x7F]" == "[\x7F]"
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0"/>

View File

@@ -458,10 +458,10 @@ TEST_CASE( "XmlEncode" ) {
REQUIRE( encode( stringWithQuotes, Catch::XmlEncode::ForAttributes ) == "don't &quot;quote&quot; me on that" );
}
SECTION( "string with control char (1)" ) {
REQUIRE( encode( "[\x01]" ) == "[&#x01;]" );
REQUIRE( encode( "[\x01]" ) == "[\\x01]" );
}
SECTION( "string with control char (x7F)" ) {
REQUIRE( encode( "[\x7F]" ) == "[&#x7F;]" );
REQUIRE( encode( "[\x7F]" ) == "[\\x7F]" );
}
}