Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59357 - in trunk/libs/spirit/test: karma qi
From: hartmut.kaiser_at_[hidden]
Date: 2010-01-29 21:18:11


Author: hkaiser
Date: 2010-01-29 21:18:10 EST (Fri, 29 Jan 2010)
New Revision: 59357
URL: http://svn.boost.org/trac/boost/changeset/59357

Log:
Spirit: added tests for sequences with unused attribute at the end
Text files modified:
   trunk/libs/spirit/test/karma/sequence.cpp | 8 ++++++++
   trunk/libs/spirit/test/qi/sequence.cpp | 11 +++++++++--
   2 files changed, 17 insertions(+), 2 deletions(-)

Modified: trunk/libs/spirit/test/karma/sequence.cpp
==============================================================================
--- trunk/libs/spirit/test/karma/sequence.cpp (original)
+++ trunk/libs/spirit/test/karma/sequence.cpp 2010-01-29 21:18:10 EST (Fri, 29 Jan 2010)
@@ -84,6 +84,14 @@
         }
 
         {
+ // literal generators do not need an attribute, not even at the end
+ fusion::vector<char, char> p('a', 'c');
+ BOOST_TEST(test("acb", char_ << char_ << 'b', p));
+ BOOST_TEST(test_delimited("a c b ",
+ char_ << char_ << 'b', p, char(' ')));
+ }
+
+ {
             std::list<int> v;
             v.push_back(1);
             v.push_back(2);

Modified: trunk/libs/spirit/test/qi/sequence.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/sequence.cpp (original)
+++ trunk/libs/spirit/test/qi/sequence.cpp 2010-01-29 21:18:10 EST (Fri, 29 Jan 2010)
@@ -47,7 +47,6 @@
         BOOST_TEST((test("xi", char_('x') >> char_('i'))));
         BOOST_TEST((!test("xi", char_('x') >> char_('o'))));
         BOOST_TEST((test("xin", char_('x') >> char_('i') >> char_('n'))));
-
     }
 
     {
@@ -84,7 +83,15 @@
     }
 
     {
- // "hello" has an unused_type. unused attrubutes are not part of the sequence
+ // unused_type means we don't care about the attribute, even at the end
+ vector<char, char> attr;
+ BOOST_TEST((test_attr("acb", char_ >> char_ >> 'b', attr)));
+ BOOST_TEST((at_c<0>(attr) == 'a'));
+ BOOST_TEST((at_c<1>(attr) == 'c'));
+ }
+
+ {
+ // "hello" has an unused_type. unused attributes are not part of the sequence
         vector<char, char> attr;
         BOOST_TEST((test_attr("a hello c", char_ >> "hello" >> char_, attr, space)));
         BOOST_TEST((at_c<0>(attr) == 'a'));


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk