]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/metaparse/test/transform_error.cpp
1 // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
6 #include <boost/metaparse/transform_error.hpp>
7 #include <boost/metaparse/start.hpp>
8 #include <boost/metaparse/string.hpp>
9 #include <boost/metaparse/reject.hpp>
10 #include <boost/metaparse/lit_c.hpp>
11 #include <boost/metaparse/get_position.hpp>
13 #include <boost/mpl/assert.hpp>
15 #include <boost/type_traits.hpp>
17 #include "test_case.hpp"
19 using boost::metaparse::reject
;
20 using boost::metaparse::get_position
;
26 typedef new_message type
;
31 typedef change_message type
;
34 struct apply
: reject
<new_message
, get_position
<E
> > {};
38 BOOST_METAPARSE_TEST_CASE(transform_error
)
40 using boost::metaparse::transform_error
;
41 using boost::metaparse::start
;
42 using boost::metaparse::string
;
43 using boost::metaparse::lit_c
;
47 typedef string
<'H','e','l','l','o'> s
;
49 // test_transform_error_does_not_change_accept
52 lit_c
<'H'>::apply
<s
, start
>::type
,
53 transform_error
<lit_c
<'H'>, change_message
>::apply
<s
, start
>::type
57 // test_transform_is_called
60 reject
<new_message
, start
>,
61 transform_error
<lit_c
<'x'>, change_message
>::apply
<s
, start
>::type