Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73420 - trunk/libs/spirit/test/qi
From: joel_at_[hidden]
Date: 2011-07-28 19:33:10


Author: djowel
Date: 2011-07-28 19:33:09 EDT (Thu, 28 Jul 2011)
New Revision: 73420
URL: http://svn.boost.org/trac/boost/changeset/73420

Log:
test case where literals emit an attribute of /0
Text files modified:
   trunk/libs/spirit/test/qi/rule4.cpp | 14 +++++++++++++-
   1 files changed, 13 insertions(+), 1 deletions(-)

Modified: trunk/libs/spirit/test/qi/rule4.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/rule4.cpp (original)
+++ trunk/libs/spirit/test/qi/rule4.cpp 2011-07-28 19:33:09 EDT (Thu, 28 Jul 2011)
@@ -138,7 +138,7 @@
         typedef boost::variant<double, int> v_type;
         rule<const char*, v_type()> r1 = int_;
         v_type v;
- BOOST_TEST(test_attr("1", r1, v) && v.which() == 1 &&
+ BOOST_TEST(test_attr("1", r1, v) && v.which() == 1 &&
             boost::get<int>(v) == 1);
 
         typedef boost::optional<int> ov_type;
@@ -183,6 +183,18 @@
         BOOST_TEST(test_attr(" 456", r2[_val = _1], j, space) && j == 456);
     }
 
+ {
+ using boost::spirit::qi::lexeme;
+ using boost::spirit::qi::alnum;
+
+ rule<const char*, std::string()> literal_;
+ literal_ = lexeme[ +(alnum | '_') ];
+
+ std::string attr;
+ BOOST_TEST(test_attr("foo_bar", literal_, attr) && attr == "foo_bar");
+ std::cout << attr << std::endl;
+ }
+
     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