Skip to content

Commit 347113d

Browse files
committed
Code cleanup
1 parent 3482a08 commit 347113d

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

test/test.cc

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,12 @@ TEST_CASE("String capture test2", "[general]")
106106

107107
TEST_CASE("String capture test3", "[general]")
108108
{
109-
auto syntax =
110-
" ROOT <- _ TOKEN* "
111-
" TOKEN <- '[' < (!']' .)+ > ']' _ "
112-
" _ <- [ \t\r\n]* "
113-
;
109+
parser pg(R"(
110+
ROOT <- _ TOKEN*
111+
TOKEN <- '[' < (!']' .)+ > ']' _
112+
_ <- [ \t\r\n]*
113+
)");
114114

115-
parser pg(syntax);
116115

117116
std::vector<std::string> tags;
118117

@@ -450,14 +449,12 @@ TEST_CASE("mutable lambda test", "[general]")
450449

451450
TEST_CASE("Simple calculator test", "[general]")
452451
{
453-
auto syntax = R"(
452+
parser parser(R"(
454453
Additive <- Multitive '+' Additive / Multitive
455454
Multitive <- Primary '*' Multitive / Primary
456455
Primary <- '(' Additive ')' / Number
457456
Number <- [0-9]+
458-
)";
459-
460-
parser parser(syntax);
457+
)");
461458

462459
parser["Additive"] = [](const SemanticValues& sv) {
463460
switch (sv.choice()) {
@@ -816,9 +813,9 @@ TEST_CASE("Semantic values test", "[general]")
816813

817814
TEST_CASE("Ordered choice count", "[general]")
818815
{
819-
auto syntax = R"(S <- 'a' / 'b')";
820-
821-
parser parser(syntax);
816+
parser parser(R"(
817+
S <- 'a' / 'b'
818+
)");
822819

823820
parser["S"] = [](const SemanticValues& sv) {
824821
REQUIRE(sv.choice() == 1);
@@ -830,9 +827,9 @@ TEST_CASE("Ordered choice count", "[general]")
830827

831828
TEST_CASE("Ordered choice count 2", "[general]")
832829
{
833-
auto syntax = R"(S <- ('a' / 'b')*)";
834-
835-
parser parser(syntax);
830+
parser parser(R"(
831+
S <- ('a' / 'b')*
832+
)");
836833

837834
parser["S"] = [](const SemanticValues& sv) {
838835
REQUIRE(sv.choice() == 0);

0 commit comments

Comments
 (0)