Skip to content

Commit ff6bf78

Browse files
committed
test.cpp: added test for #185
1 parent ef9fcc8 commit ff6bf78

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

test.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,33 @@ static void define16() // #201
783783
"\"Blue\" , \"Green\" , \"Purple\" , \"Red\" , \"Yellow\" , \"Orange\" ,", preprocess(code));
784784
}
785785

786+
static void define17() // #185
787+
{
788+
const char code[] = "#define at(x, y) x##y\n"
789+
"#define b(...) \\\n"
790+
"aa(__VA_ARGS__, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , \\\n"
791+
", , , , , , , , 2)\n"
792+
"#define aa(c, d, a, b, e, f, g, h, ab, ac, i, ad, j, k, l, m, n, o, p, ae, q, \\\n"
793+
"r, s, t, u, v, w, x, y, z, af, ag, ah, ai, aj, ak, al, am, an, ao, \\\n"
794+
"ap) \\\n"
795+
"ap\n"
796+
"#define aq(...) ar(b(__VA_ARGS__), __VA_ARGS__) static_assert(true, \" \")\n"
797+
"#define ar(ap, ...) at(I_, ap)(__VA_ARGS__)\n"
798+
"#define I_2(as, a)\n"
799+
"aq(a, array);\n";
800+
ASSERT_EQUALS("\n"
801+
"\n"
802+
"\n"
803+
"\n"
804+
"\n"
805+
"\n"
806+
"\n"
807+
"\n"
808+
"\n"
809+
"\n"
810+
"\n"
811+
"static_assert ( true , \" \" ) ;", preprocess(code));
812+
}
786813

787814

788815
static void define_invalid_1()
@@ -3761,6 +3788,7 @@ static void runTests(int argc, char **argv, Input input)
37613788
TEST_CASE(define14); // #296
37623789
TEST_CASE(define15); // #231
37633790
TEST_CASE(define16); // #201
3791+
TEST_CASE(define17); // #185
37643792
TEST_CASE(define_invalid_1);
37653793
TEST_CASE(define_invalid_2);
37663794
TEST_CASE(define_define_1);

0 commit comments

Comments
 (0)