summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-06-16 00:09:32 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-06-16 00:09:32 -0700
commita3664ea971ee2fe0f2ee33a08e451ce4d6cbd2b0 (patch)
tree910176f53af632f41f431464a6c0a4e2dd8f27d5 /tests
parentd2892be902b9cabe6e3f5732b82f6f2bef8e7d2f (diff)
tests: Expand write_flush coverage
Adjust the buffer size to be right on the edge of the overflow, make sure we actually output &quot; instead of ".
Diffstat (limited to 'tests')
-rw-r--r--tests/test_write.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/test_write.cpp b/tests/test_write.cpp
index e59b7ab..be77aa8 100644
--- a/tests/test_write.cpp
+++ b/tests/test_write.cpp
@@ -645,20 +645,23 @@ TEST(write_flush_coverage)
// this creates a node that uses short sequences of lengths 1-6 for output
xml_node n = doc.append_child(STR("n"));
- n.text().set(STR("<&\""));
- n.append_child(node_comment);
xml_attribute a = n.append_attribute(STR("a"));
- size_t basel = save_narrow(doc, 0, encoding_auto).size();
- size_t bufl = 10240;
+ xml_attribute b = n.append_attribute(STR("b"));
+ b.set_value(STR("<&\""));
+
+ n.append_child(node_comment);
+
+ size_t basel = save_narrow(doc, format_raw, encoding_auto).size();
+ size_t bufl = 2048;
for (size_t l = 0; l <= basel; ++l)
{
std::basic_string<pugi::char_t> pad(bufl - l, STR('v'));
a.set_value(pad.c_str());
- std::string s = save_narrow(doc, 0, encoding_auto);
+ std::string s = save_narrow(doc, format_raw, encoding_auto);
CHECK(s.size() == basel + bufl - l);
}
}