diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2015-04-21 21:27:44 -0700 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2015-04-21 21:27:44 -0700 |
commit | f9983ea2ed47811ad5a7e41b816642615cbd674f (patch) | |
tree | c20551f1a314ee5776680d9171388cfa5f8bd95a /tests/test_write.cpp | |
parent | cb786665d44598cbaff721e50d6a56b7538789e5 (diff) | |
parent | a6cc636a6b0d531686311b5666ea77225b10903e (diff) |
Merge branch 'master' into compact
Diffstat (limited to 'tests/test_write.cpp')
-rw-r--r-- | tests/test_write.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/test_write.cpp b/tests/test_write.cpp index af4acf4..df7b0b1 100644 --- a/tests/test_write.cpp +++ b/tests/test_write.cpp @@ -21,6 +21,31 @@ TEST_XML(write_indent, "<node attr='1'><child><sub>text</sub></child></node>") CHECK_NODE_EX(doc, STR("<node attr=\"1\">\n\t<child>\n\t\t<sub>text</sub>\n\t</child>\n</node>\n"), STR("\t"), format_indent); } +TEST_XML(write_indent_attributes, "<node attr='1' other='2'><child><sub>text</sub></child></node>") +{ + CHECK_NODE_EX(doc, STR("<node\n\tattr=\"1\"\n\tother=\"2\">\n\t<child>\n\t\t<sub>text</sub>\n\t</child>\n</node>\n"), STR("\t"), format_indent_attributes); +} + +TEST_XML(write_indent_attributes_empty_element, "<node attr='1' other='2' />") +{ + CHECK_NODE_EX(doc, STR("<node\n\tattr=\"1\"\n\tother=\"2\" />\n"), STR("\t"), format_indent_attributes); +} + +TEST_XML_FLAGS(write_indent_attributes_declaration, "<?xml version=\"1.0\" encoding=\"UTF-8\"?><node attr='1' other='2' />", parse_full) +{ + CHECK_NODE_EX(doc, STR("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<node\n\tattr=\"1\"\n\tother=\"2\" />\n"), STR("\t"), format_indent_attributes); +} + +TEST_XML(write_indent_attributes_raw, "<node attr='1' other='2'><child><sub>text</sub></child></node>") +{ + CHECK_NODE_EX(doc, STR("<node attr=\"1\" other=\"2\"><child><sub>text</sub></child></node>"), STR("\t"), format_indent_attributes | format_raw); +} + +TEST_XML(write_indent_attributes_empty_indent, "<node attr='1' other='2'><child><sub>text</sub></child></node>") +{ + CHECK_NODE_EX(doc, STR("<node\nattr=\"1\"\nother=\"2\">\n<child>\n<sub>text</sub>\n</child>\n</node>\n"), STR(""), format_indent_attributes); +} + TEST_XML(write_pcdata, "<node attr='1'><child><sub/>text</child></node>") { CHECK_NODE_EX(doc, STR("<node attr=\"1\">\n\t<child>\n\t\t<sub />text</child>\n</node>\n"), STR("\t"), format_indent); @@ -360,7 +385,7 @@ TEST(write_encoding_huge_invalid) TEST(write_unicode_escape) { char s_utf8[] = "<\xE2\x82\xAC \xC2\xA2='\"\xF0\xA4\xAD\xA2
\"'>&\x14\xF0\xA4\xAD\xA2<</\xE2\x82\xAC>"; - + xml_document doc; CHECK(doc.load_buffer(s_utf8, sizeof(s_utf8), parse_default, encoding_utf8)); |