fix(parser): parse spaced and negated defined checks (#926)

This commit is contained in:
mo
2026-07-23 19:27:52 +02:00
committed by GitHub
parent 52f557a9bb
commit b154ee95a4
2 changed files with 26 additions and 1 deletions
@@ -589,6 +589,28 @@ namespace test::parsing::impl::defines_stream_proxy
REQUIRE(proxy.Eof());
}
TEST_CASE("DefinesStreamProxy: Can negate spaced defined operator", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{
"#if defined( CONSOLE ) && !defined( SPLITSCREEN )",
"Console",
"#else",
"PC",
"#endif",
};
MockParserLineStream mockStream(lines);
DefinesStreamProxy proxy(&mockStream);
ExpectLine(&proxy, 1, "");
ExpectLine(&proxy, 2, "");
ExpectLine(&proxy, 3, "");
ExpectLine(&proxy, 4, "PC");
ExpectLine(&proxy, 5, "");
REQUIRE(proxy.Eof());
}
TEST_CASE("DefinesStreamProxy: Ensure can use elif", "[parsing][parsingstream]")
{
const std::vector<std::string> lines{