MCPcopy Create free account
hub / github.com/boostorg/parser / main

Function main

test/parser_quoted_string.cpp:21–373  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19 {"t", '\t'}, {"r", '\r'}, {"n", '\n'}};
20
21int 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

Callers

nothing calls this directly

Calls 2

quoted_stringClass · 0.85
parseFunction · 0.50

Tested by

no test coverage detected