summaryrefslogtreecommitdiff
path: root/tests/test_parse.cpp
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-01-31 20:36:59 -0800
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-01-31 20:40:50 -0800
commit1a3e92a7cc80a719efd988f14860a1aa9692d584 (patch)
treec37cc873bc9ecaaee551b5b326c15c589269f1e5 /tests/test_parse.cpp
parent094a0c8ebe44a1bfeb8575b33138a8b258bf8f4b (diff)
tests: Add more tests to increase coverage
This change adds more thorough tests for attribute conversion as well as some assorted tests that fix gaps in coverage.
Diffstat (limited to 'tests/test_parse.cpp')
-rw-r--r--tests/test_parse.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_parse.cpp b/tests/test_parse.cpp
index fa9555d..882ba3a 100644
--- a/tests/test_parse.cpp
+++ b/tests/test_parse.cpp
@@ -746,6 +746,36 @@ TEST(parse_attribute_quot_inside)
}
}
+TEST(parse_attribute_wnorm_coverage)
+{
+ xml_document doc;
+ CHECK(doc.load_string(STR("<n a1='v' a2=' ' a3='x y' a4='x y' a5='x y' />"), parse_wnorm_attribute));
+ CHECK_NODE(doc, STR("<n a1=\"v\" a2=\"\" a3=\"x y\" a4=\"x y\" a5=\"x y\"/>"));
+
+ CHECK(doc.load_string(STR("<n a1='v' a2=' ' a3='x y' a4='x y' a5='x y' />"), parse_wnorm_attribute | parse_escapes));
+ CHECK_NODE(doc, STR("<n a1=\"v\" a2=\"\" a3=\"x y\" a4=\"x y\" a5=\"x y\"/>"));
+}
+
+TEST(parse_attribute_wconv_coverage)
+{
+ xml_document doc;
+ CHECK(doc.load_string(STR("<n a1='v' a2='\r' a3='\r\n\n' a4='\n' />"), parse_wconv_attribute));
+ CHECK_NODE(doc, STR("<n a1=\"v\" a2=\" \" a3=\" \" a4=\" \"/>"));
+
+ CHECK(doc.load_string(STR("<n a1='v' a2='\r' a3='\r\n\n' a4='\n' />"), parse_wconv_attribute | parse_escapes));
+ CHECK_NODE(doc, STR("<n a1=\"v\" a2=\" \" a3=\" \" a4=\" \"/>"));
+}
+
+TEST(parse_attribute_eol_coverage)
+{
+ xml_document doc;
+ CHECK(doc.load_string(STR("<n a1='v' a2='\r' a3='\r\n\n' a4='\n' />"), parse_eol));
+ CHECK_NODE(doc, STR("<n a1=\"v\" a2=\"&#10;\" a3=\"&#10;&#10;\" a4=\"&#10;\"/>"));
+
+ CHECK(doc.load_string(STR("<n a1='v' a2='\r' a3='\r\n\n' a4='\n' />"), parse_eol | parse_escapes));
+ CHECK_NODE(doc, STR("<n a1=\"v\" a2=\"&#10;\" a3=\"&#10;&#10;\" a4=\"&#10;\"/>"));
+}
+
TEST(parse_tag_single)
{
xml_document doc;