diff options
author | m-naumann <maximilian.naumann@kit.edu> | 2019-06-18 19:51:10 -0700 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2019-06-18 19:51:10 -0700 |
commit | 5a867cb1e38960559b0636bbdc8ea57af151b1ea (patch) | |
tree | c08325b6ac1483de76270fa9a9401c07996bc4a5 /tests | |
parent | fcb7c8d3e5335c76bd2aa81f40a153f9b2b05647 (diff) | |
download | pugixml-5a867cb1e38960559b0636bbdc8ea57af151b1ea.zip pugixml-5a867cb1e38960559b0636bbdc8ea57af151b1ea.tar.gz pugixml-5a867cb1e38960559b0636bbdc8ea57af151b1ea.tar.bz2 |
Add support for using single quotes to enclose attribute values
This change adds format_attribute_single_quote flag that uses single quotes (`'`) instead of double quotes (`"`) for formatting attribute values.
Internal quotation marks are escaped using `"` and `'`.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_write.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/test_write.cpp b/tests/test_write.cpp index 9050807..9a0ed06 100644 --- a/tests/test_write.cpp +++ b/tests/test_write.cpp @@ -193,7 +193,7 @@ TEST_XML(write_escape, "<node attr=''>text</node>") doc.child(STR("node")).attribute(STR("attr")) = STR("<>'\"&\x04\r\n\t"); doc.child(STR("node")).first_child().set_value(STR("<>'\"&\x04\r\n\t")); - CHECK_NODE(doc, STR("<node attr=\"<>'"& 	\"><>'\"&\r\n\t</node>")); + CHECK_NODE(doc, STR("<node attr=\"<>'"& 	\"><>'\"&\r\n\t</node>")); } TEST_XML(write_escape_roundtrip, "<node attr=''>text</node>") @@ -207,7 +207,7 @@ TEST_XML(write_escape_roundtrip, "<node attr=''>text</node>") // Note: this string is almost identical to the string from write_escape with the exception of \r // \r in PCDATA doesn't roundtrip because it has to go through newline conversion (which could be disabled, but is active by default) - CHECK_NODE(doc, STR("<node attr=\"<>'"& 	\"><>'\"&\n\t</node>")); + CHECK_NODE(doc, STR("<node attr=\"<>'"& 	\"><>'\"&\n\t</node>")); } TEST_XML(write_escape_unicode, "<node attr='㰀'/>") @@ -632,7 +632,7 @@ TEST_XML(write_no_empty_element_tags, "<node><child1/><child2>text</child2><chil TEST_XML_FLAGS(write_roundtrip, "<node><child1 attr1='value1' attr2='value2'/><child2 attr='value'>pre<![CDATA[data]]>mid<text&escape<!--comment--><test/>post<?pi value?>fin</child2><child3/></node>", parse_full) { - const unsigned int flagset[] = { format_indent, format_raw, format_no_declaration, format_indent_attributes, format_no_empty_element_tags }; + const unsigned int flagset[] = { format_indent, format_raw, format_no_declaration, format_indent_attributes, format_no_empty_element_tags, format_attribute_single_quote }; size_t flagcount = sizeof(flagset) / sizeof(flagset[0]); for (size_t i = 0; i < (size_t(1) << flagcount); ++i) |