regression_lazy_repeat.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /*=============================================================================
  2. Copyright (c) 2011 Bryce Lelbach
  3. Use, modification and distribution is subject to the Boost Software
  4. License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  5. http://www.boost.org/LICENSE_1_0.txt)
  6. =============================================================================*/
  7. #include <boost/detail/lightweight_test.hpp>
  8. #include <boost/spirit/include/qi_operator.hpp>
  9. #include <boost/spirit/include/qi_char.hpp>
  10. #include <boost/spirit/include/qi_repeat.hpp>
  11. #include <boost/spirit/include/phoenix_core.hpp>
  12. #include "test.hpp"
  13. int
  14. main()
  15. {
  16. using spirit_test::test_attr;
  17. using boost::spirit::qi::repeat;
  18. using boost::spirit::qi::char_;
  19. using boost::phoenix::ref;
  20. int n = 5;
  21. std::string s = "";
  22. // this was broken by the addition of handles_container, due to incorrect
  23. // dispatching of lazy parsers/directives/terminals in pass_container
  24. BOOST_TEST(test_attr("foobar", char_ >> repeat(ref(n))[char_], s));
  25. BOOST_TEST_EQ(s, "foobar");
  26. return boost::report_errors();
  27. }