$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: eric_at_[hidden]
Date: 2007-10-11 17:12:22
Author: eric_niebler
Date: 2007-10-11 17:12:22 EDT (Thu, 11 Oct 2007)
New Revision: 39946
URL: http://svn.boost.org/trac/boost/changeset/39946
Log:
add tests for late-bound action args with regex_(token_)iterator
Text files modified: 
   trunk/libs/xpressive/test/test_actions.cpp |    34 +++++++++++++++++++++++-----------      
   1 files changed, 23 insertions(+), 11 deletions(-)
Modified: trunk/libs/xpressive/test/test_actions.cpp
==============================================================================
--- trunk/libs/xpressive/test/test_actions.cpp	(original)
+++ trunk/libs/xpressive/test/test_actions.cpp	2007-10-11 17:12:22 EDT (Thu, 11 Oct 2007)
@@ -132,17 +132,29 @@
     std::map<std::string, int> result;
     what.let(_map = result); // bind the argument!
 
-    if(!regex_match(str, what, rx))
-    {
-        BOOST_ERROR("oops");
-    }
-    else
-    {
-        BOOST_REQUIRE_EQUAL(result.size(), 3u);
-        BOOST_CHECK_EQUAL(result["aaa"], 1);
-        BOOST_CHECK_EQUAL(result["bbb"], 23);
-        BOOST_CHECK_EQUAL(result["ccc"], 456);
-    }
+    BOOST_REQUIRE(regex_match(str, what, rx));
+    BOOST_REQUIRE_EQUAL(result.size(), 3u);
+    BOOST_CHECK_EQUAL(result["aaa"], 1);
+    BOOST_CHECK_EQUAL(result["bbb"], 23);
+    BOOST_CHECK_EQUAL(result["ccc"], 456);
+
+    // Try the same test with regex_iterator
+    result.clear();
+    sregex_iterator it(str.begin(), str.end(), pair, let(_map=result)), end;
+    BOOST_REQUIRE_EQUAL(3, std::distance(it, end));
+    BOOST_REQUIRE_EQUAL(result.size(), 3u);
+    BOOST_CHECK_EQUAL(result["aaa"], 1);
+    BOOST_CHECK_EQUAL(result["bbb"], 23);
+    BOOST_CHECK_EQUAL(result["ccc"], 456);
+
+    // Try the same test with regex_token_iterator
+    result.clear();
+    sregex_token_iterator it2(str.begin(), str.end(), pair, (s1,s2), let(_map=result)), end2;
+    BOOST_REQUIRE_EQUAL(6, std::distance(it2, end2));
+    BOOST_REQUIRE_EQUAL(result.size(), 3u);
+    BOOST_CHECK_EQUAL(result["aaa"], 1);
+    BOOST_CHECK_EQUAL(result["bbb"], 23);
+    BOOST_CHECK_EQUAL(result["ccc"], 456);
 }
 
 ///////////////////////////////////////////////////////////////////////////////