| 19 | {"t", '\t'}, {"r", '\r'}, {"n", '\n'}}; |
| 20 | |
| 21 | int main() |
| 22 | { |
| 23 | |
| 24 | // basic |
| 25 | { |
| 26 | constexpr auto parser = bp::quoted_string; |
| 27 | |
| 28 | { |
| 29 | auto result = bp::parse("", parser, bp::ws); |
| 30 | BOOST_TEST(!result); |
| 31 | } |
| 32 | |
| 33 | { |
| 34 | auto result = bp::parse(R"("foo")", parser, bp::ws); |
| 35 | BOOST_TEST(result); |
| 36 | BOOST_TEST(*result == "foo"); |
| 37 | } |
| 38 | |
| 39 | { |
| 40 | auto result = bp::parse(R"("foo\\")", parser, bp::ws); |
| 41 | BOOST_TEST(result); |
| 42 | BOOST_TEST(*result == "foo\\"); |
| 43 | } |
| 44 | |
| 45 | { |
| 46 | auto result = bp::parse(R"("\"foo\"")", parser, bp::ws); |
| 47 | BOOST_TEST(result); |
| 48 | BOOST_TEST(*result == "\"foo\""); |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | // different_quote |
| 53 | { |
| 54 | constexpr auto parser = bp::quoted_string('\''); |
| 55 | |
| 56 | { |
| 57 | auto result = bp::parse("", parser, bp::ws); |
| 58 | BOOST_TEST(!result); |
| 59 | } |
| 60 | |
| 61 | { |
| 62 | auto result = bp::parse(R"('foo')", parser, bp::ws); |
| 63 | BOOST_TEST(result); |
| 64 | BOOST_TEST(*result == "foo"); |
| 65 | } |
| 66 | |
| 67 | { |
| 68 | auto result = bp::parse(R"('foo\\')", parser, bp::ws); |
| 69 | BOOST_TEST(result); |
| 70 | BOOST_TEST(*result == "foo\\"); |
| 71 | } |
| 72 | |
| 73 | { |
| 74 | auto result = bp::parse(R"('\'foo\'')", parser, bp::ws); |
| 75 | BOOST_TEST(result); |
| 76 | BOOST_TEST(*result == "'foo'"); |
| 77 | } |
| 78 |
nothing calls this directly
no test coverage detected