Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52933 - trunk/libs/spirit/test/qi
From: hartmut.kaiser_at_[hidden]
Date: 2009-05-11 23:00:34


Author: hkaiser
Date: 2009-05-11 23:00:34 EDT (Mon, 11 May 2009)
New Revision: 52933
URL: http://svn.boost.org/trac/boost/changeset/52933

Log:
Spirit: refined regression test
Text files modified:
   trunk/libs/spirit/test/qi/alternative.cpp | 11 ++++++++---
   1 files changed, 8 insertions(+), 3 deletions(-)

Modified: trunk/libs/spirit/test/qi/alternative.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/alternative.cpp (original)
+++ trunk/libs/spirit/test/qi/alternative.cpp 2009-05-11 23:00:34 EDT (Mon, 11 May 2009)
@@ -26,13 +26,18 @@
 
 struct print_action
 {
+ print_action(char last)
+ : last_(last) {}
+
     void operator()(std::vector<char> const& v
       , boost::spirit::unused_type
       , boost::spirit::unused_type) const
     {
         BOOST_TEST(v.size() == 4 &&
- v[0] =='a' && v[1] =='b' && v[2] =='1' && v[3] =='2');
+ v[0] == 'a' && v[1] == 'b' && v[2] == '1' && v[3] == last_);
     }
+
+ char last_;
 };
 
 int
@@ -133,8 +138,8 @@
         using boost::spirit::ascii::alpha;
         using boost::spirit::ascii::digit;
 
- BOOST_TEST( (test("ab12", lexeme[*(alnum | '_')][print_action()])) );
- BOOST_TEST( (test("ab12", lexeme[*(alpha | digit)][print_action()])) );
+ BOOST_TEST( (test("ab1_", lexeme[*(alnum | '_')][print_action('_')])) );
+ BOOST_TEST( (test("ab12", lexeme[*(alpha | digit)][print_action('2')])) );
     }
 
     return boost::report_errors();


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