Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add test
  • Loading branch information
ludviggunne committed Aug 20, 2026
commit f57d2014394a23cee27848398a39939984d000e0
26 changes: 26 additions & 0 deletions test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3782,6 +3782,31 @@ static void tokenMacro5()
ASSERT_EQUALS("SET_BPF_JUMP", tok->macro);
}

static void tokenMacro6()
{
const char code[] = "#define FILE() __FILE__\n"
"#define LINE() __LINE__\n"
"#define COUNTER() __COUNTER__\n"
"FILE()\n"
"LINE()\n"
"COUNTER()\n";
std::vector<std::string> files;
simplecpp::FileDataCache cache;
simplecpp::TokenList tokenList(files);
const simplecpp::TokenList rawtokens = makeTokenList(code,files);
simplecpp::preprocess(tokenList, rawtokens, files, cache, simplecpp::DUI());
const simplecpp::Token *tok;

tok = tokenList.cfront();
ASSERT_EQUALS("__FILE__", tok->macro);

tok = tok->next;
ASSERT_EQUALS("__LINE__", tok->macro);

tok = tok->next;
ASSERT_EQUALS("__COUNTER__", tok->macro);
}

static void undef()
{
const char code[] = "#define A\n"
Expand Down Expand Up @@ -4781,6 +4806,7 @@ static void runTests(int argc, char **argv, Input input)
TEST_CASE(tokenMacro3);
TEST_CASE(tokenMacro4);
TEST_CASE(tokenMacro5);
TEST_CASE(tokenMacro6);

TEST_CASE(undef);

Expand Down