X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;ds=sidebyside;f=ccan%2Fcppmagic%2Ftest%2Frun.c;fp=ccan%2Fcppmagic%2Ftest%2Frun.c;h=2aa95303ed52d21a14f3a536cc580e7d7050bf07;hb=7ddee86d9ac424dbec04583e37e9584375bd6d74;hp=0f8917d6a4afa5d8e620504a197fd7ae14cec7b8;hpb=395a2f841356e5bba4935a24093d30d67c1f3ef5;p=ccan diff --git a/ccan/cppmagic/test/run.c b/ccan/cppmagic/test/run.c index 0f8917d6..2aa95303 100644 --- a/ccan/cppmagic/test/run.c +++ b/ccan/cppmagic/test/run.c @@ -15,9 +15,12 @@ static inline void check1(const char *orig, const char *expand, #define CHECK1(orig, match) \ check1(#orig, CPPMAGIC_STRINGIFY(orig), match) +#define TESTRECURSE() R CPPMAGIC_DEFER1(_TESTRECURSE)()() +#define _TESTRECURSE() TESTRECURSE + int main(void) { - plan_tests(24); + plan_tests(27); CHECK1(CPPMAGIC_NOTHING(), ""); CHECK1(CPPMAGIC_GLUE2(a, b), "ab"); @@ -51,6 +54,10 @@ int main(void) CHECK1(CPPMAGIC_IFELSE(1)(abc)(def), "abc"); CHECK1(CPPMAGIC_IFELSE(not zero)(abc)(def), "abc"); + CHECK1(TESTRECURSE(), "R R _TESTRECURSE ()()"); + CHECK1(CPPMAGIC_EVAL1(TESTRECURSE()), "R R R _TESTRECURSE ()()"); + CHECK1(CPPMAGIC_EVAL2(TESTRECURSE()), "R R R R R _TESTRECURSE ()()"); + /* This exits depending on whether all tests passed */ return exit_status(); }