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) 5 6 #include <boost/metaparse/fail_at_first_char_expected.hpp> 7 #include <boost/metaparse/is_error.hpp> 8 #include <boost/metaparse/start.hpp> 9 #include <boost/metaparse/keyword.hpp> 10 11 #include <boost/mpl/assert.hpp> 12 13 #include "common.hpp" 14 15 #include "test_case.hpp" 16 BOOST_METAPARSE_TEST_CASE(fail_at_first_char_expected)17BOOST_METAPARSE_TEST_CASE(fail_at_first_char_expected) 18 { 19 using boost::metaparse::fail_at_first_char_expected; 20 using boost::metaparse::is_error; 21 using boost::metaparse::start; 22 23 typedef boost::metaparse::keyword<str_hello> accept_hello; 24 25 // test_failure_at_first_char_is_ignored 26 BOOST_MPL_ASSERT_NOT(( 27 is_error<fail_at_first_char_expected<accept_hello>::apply<str_ab, start> > 28 )); 29 30 // test_no_failure_is_error 31 BOOST_MPL_ASSERT(( 32 is_error< 33 fail_at_first_char_expected<accept_hello>::apply<str_hello, start> 34 > 35 )); 36 37 // test_failure_at_second_char_is_not_ignored 38 BOOST_MPL_ASSERT(( 39 is_error< fail_at_first_char_expected<accept_hello>::apply<str_h, start> > 40 )); 41 } 42 43