Skip to content

Commit

Permalink
Add a test for a recursive expansion error.
Browse files Browse the repository at this point in the history
  • Loading branch information
oo13 committed Jun 23, 2024
1 parent 3b73e47 commit 2b17a5c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/test_parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,5 +380,18 @@ Hello World.)");
return r == "nil" && err_msg.find("The end of the text or \"\\n\" is expected.") != err_msg.npos;
});

ut.set_test("Recursive Expansion Error", [&]() {
tphrase::Generator ph;
ph.add(R"(
main = {A}
A = {B}
B = {C}
C = {B}
)");
const auto r = ph.generate();
const std::string err_msg{ph.get_error_message()};
return r == "nil" && err_msg.find("Recursive expansion of \"B\" is detected.") != err_msg.npos;
});

return ut.run();
}

0 comments on commit 2b17a5c

Please sign in to comment.