fix: Keep string literals whole in macro arguments (#1065)

This commit is contained in:
wroy authored and GitHub committed 2026-11-18 19:46:14 +01:00
1 parent 9ec01498ac
commit 0beced197e
3 files changed
+41 -2

No files matched your search

@@ -915,6 +915,24 @@ namespace test::parsing::impl::defines_stream_proxy
REQUIRE(proxy.Eof());
}
TEST_CASE("DefinesStreamProxy: Macro arguments can contain strings with commas and brackets", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{
"#define testMacro(a, b) [a|b]",
R"(testMacro("Hello, world", "a ) b"))",
R"(testMacro("with \"quotes, and\" more", x))",
};
MockParserLineStream mockStream(lines);
DefinesStreamProxy proxy(&mockStream);
ExpectLine(&proxy, 1, "");
ExpectLine(&proxy, 2, R"(["Hello, world"|"a ) b"])");
ExpectLine(&proxy, 3, R"(["with \"quotes, and\" more"|x])");
REQUIRE(proxy.Eof());
}
TEST_CASE("DefinesStreamProxy: Can use second macro after multi-line macro", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{