aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2014-10-29 19:25:51 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2014-10-29 19:25:51 +0200
commit7275dc4d919b0cb6f8713d0b4a9a2b507051cded (patch)
tree3ffc5b1df9a479bcddb20187ae9fb7152d8bb8b6 /tests
parent382f3ebd7ffe0a12e2ad1e0dc14e02f1122ac3df (diff)
Add value_traits specialization for std::string
The default implementation uses istream::operator>> which ignores spaces.
Diffstat (limited to 'tests')
-rw-r--r--tests/parser/driver.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/parser/driver.cxx b/tests/parser/driver.cxx
index 4e0fbae..c1c6f3d 100644
--- a/tests/parser/driver.cxx
+++ b/tests/parser/driver.cxx
@@ -470,4 +470,16 @@ main ()
assert (v[3] == parser::end_element);
assert (v[4] == parser::end_element);
}
+
+ // Test space extraction into the std::string value.
+ //
+ {
+ istringstream is ("<root a=' a '> b </root>");
+ parser p (is, "test");
+ p.next_expect (parser::start_element, "root");
+ assert (p.attribute<std::string> ("a") == " a ");
+ p.next_expect (parser::characters);
+ assert (p.value<std::string> () == " b ");
+ p.next_expect (parser::end_element);
+ }
}