Skip to content

Commit 04b4e45

Browse files
committed
add test
1 parent 8558255 commit 04b4e45

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

test.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,27 @@ static void comment_multiline()
565565
ASSERT_EQUALS("// abc\ndef", readfile("// abc\\\ndef"));
566566
}
567567

568+
static void keep_comments()
569+
{
570+
simplecpp::DUI dui;
571+
dui.removeComments = false;
572+
573+
{
574+
const char code[] = "/* comment */\n";
575+
ASSERT_EQUALS("/* comment */", preprocess(code,dui));
576+
}
577+
578+
{
579+
const char code[] = "// comment\n";
580+
ASSERT_EQUALS("// comment", preprocess(code,dui));
581+
}
582+
583+
{
584+
const char code[] = "#define MACRO /* comment */\nMACRO\n";
585+
ASSERT_EQUALS("\n/* comment */", preprocess(code,dui));
586+
}
587+
}
588+
568589

569590
static void constFold()
570591
{
@@ -4073,6 +4094,7 @@ static void runTests(int argc, char **argv, Input input)
40734094

40744095
TEST_CASE(comment);
40754096
TEST_CASE(comment_multiline);
4097+
TEST_CASE(keep_comments);
40764098

40774099
TEST_CASE(constFold);
40784100

0 commit comments

Comments
 (0)