diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2015-04-13 21:21:26 -0700 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2015-04-13 21:49:08 -0700 |
commit | 2a3435274f0d7d0e3ccb4417e143e5957e820332 (patch) | |
tree | 2cbf0b29bf1bcfa84a8e014f6bdc3b2c956e577c /tests/test_write.cpp | |
parent | 950693be7fb1182644b720d3044a73aaaccee1c9 (diff) |
Refactor format_indent_attributes implementation
Fix code style and revert redundant parameters/whitespace changes.
Also remove format_each_attribute_on_new_line - we're only introducing one
extra formatting flag. The flag implies format_indent but does not include its
bitmask.
Also add a few more tests.
Fixes #14.
Diffstat (limited to 'tests/test_write.cpp')
-rw-r--r-- | tests/test_write.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/tests/test_write.cpp b/tests/test_write.cpp index d280840..df7b0b1 100644 --- a/tests/test_write.cpp +++ b/tests/test_write.cpp @@ -21,21 +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_attribute, "<node attr='1' other='2'><child><sub>text</sub></child></node>") +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_attribute_empty_tag, "<node attr='1' other='2' />") +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_attribute_on_declaration, "<?xml version=\"1.0\" encoding=\"UTF-8\"?><node attr='1' other='2' />", pugi::parse_full) +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); |