aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-03-14 11:08:13 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-03-14 11:08:13 +0200
commitdac3640ed08cf18eaa6eb26605a27e6c7387b2c2 (patch)
treec22798e70696a99e24c603ffff05473937efe4bf /tests
parentce298ad2e8dbc3601d180c178bee9d606b8edab2 (diff)
Add next_expect() functions to XML parser
Diffstat (limited to 'tests')
-rw-r--r--tests/xml/parser/driver.cxx33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/xml/parser/driver.cxx b/tests/xml/parser/driver.cxx
index 31d1e97..787da50 100644
--- a/tests/xml/parser/driver.cxx
+++ b/tests/xml/parser/driver.cxx
@@ -48,6 +48,39 @@ main ()
{
}
+ // Test the next_expect() functionality.
+ //
+ {
+ istringstream is ("<root/>");
+ parser p (is, "test");
+ p.next_expect (parser::start_element, "root");
+ p.next_expect (parser::end_element);
+ }
+
+ try
+ {
+ istringstream is ("<root/>");
+ parser p (is, "test");
+ p.next_expect (parser::end_element);
+ assert (false);
+ }
+ catch (const xml::exception& e)
+ {
+ // cerr << e.what () << endl;
+ }
+
+ try
+ {
+ istringstream is ("<root/>");
+ parser p (is, "test");
+ p.next_expect (parser::start_element, "root1");
+ assert (false);
+ }
+ catch (const xml::exception& e)
+ {
+ // cerr << e.what () << endl;
+ }
+
// Test peeking and getting the current event.
//
{