|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r61727 - trunk/libs/spirit/test/karma
From: hartmut.kaiser_at_[hidden]
Date: 2010-05-01 23:07:55
Author: hkaiser
Date: 2010-05-01 23:07:54 EDT (Sat, 01 May 2010)
New Revision: 61727
URL: http://svn.boost.org/trac/boost/changeset/61727
Log:
Spirit: introduced new cutomization point for karma alternatives (variant_which) and extended strict mode to alternatives, added tests
Text files modified:
trunk/libs/spirit/test/karma/alternative.cpp | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
Modified: trunk/libs/spirit/test/karma/alternative.cpp
==============================================================================
--- trunk/libs/spirit/test/karma/alternative.cpp (original)
+++ trunk/libs/spirit/test/karma/alternative.cpp 2010-05-01 23:07:54 EDT (Sat, 01 May 2010)
@@ -16,6 +16,7 @@
#include <boost/spirit/include/karma_operator.hpp>
#include <boost/spirit/include/karma_directive.hpp>
#include <boost/spirit/include/karma_nonterminal.hpp>
+#include <boost/spirit/include/karma_auxiliary.hpp>
#include "test.hpp"
@@ -168,6 +169,16 @@
}
{
+ // in strict mode if nothing matches, the alternative will fail
+ variant<double, char const*> v (10.0);
+ BOOST_TEST(!test("11", strict[char_ | lit(11)], v));
+ BOOST_TEST(test("11", strict[lit(11) | char_] , v));
+
+ v = "c";
+ BOOST_TEST(!test("11", strict[char_ | lit(11)], v));
+ }
+
+ {
// if nothing matches, the first explicit alternative will be chosen
variant<double, char const*> v (10.0);
BOOST_TEST(test_delimited("11 ", char_ | lit(11), v, char_(' ')));
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