2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-01-09 10:11:49 +00:00

fix(parser): macros only parse parameters if define specified them

This commit is contained in:
Jan Laupetin
2026-01-03 08:49:12 +01:00
parent adb21ded77
commit 6c7dd30c78
3 changed files with 47 additions and 10 deletions

View File

@@ -1226,4 +1226,28 @@ namespace test::parsing::impl::defines_stream_proxy
REQUIRE(proxy.Eof());
}
TEST_CASE("DefinesStreamProxy: Only macros with args parse parenthesis", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{
"#define ONE result",
"#define TWO() result",
"#define THREE(f) result",
"ONE()",
"TWO()",
"THREE(f)",
};
MockParserLineStream mockStream(lines);
DefinesStreamProxy proxy(&mockStream);
ExpectLine(&proxy, 1, "");
ExpectLine(&proxy, 2, "");
ExpectLine(&proxy, 3, "");
ExpectLine(&proxy, 4, "result()");
ExpectLine(&proxy, 5, "result");
ExpectLine(&proxy, 6, "result");
REQUIRE(proxy.Eof());
}
} // namespace test::parsing::impl::defines_stream_proxy