From 91d4db600bd95318c224100f13b79de9fdd5ca79 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Mon, 7 Apr 2014 23:30:57 +0800 Subject: [PATCH] Add new tests for macro nesting --- tests/tests2/64_macro_nesting.c | 10 ++++++++++ tests/tests2/64_macro_nesting.expect | 1 + tests/tests2/Makefile | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tests/tests2/64_macro_nesting.c create mode 100644 tests/tests2/64_macro_nesting.expect diff --git a/tests/tests2/64_macro_nesting.c b/tests/tests2/64_macro_nesting.c new file mode 100644 index 00000000..44b582fe --- /dev/null +++ b/tests/tests2/64_macro_nesting.c @@ -0,0 +1,10 @@ +#define CAT2(a,b) a##b +#define CAT(a,b) CAT2(a,b) +#define AB(x) CAT(x,y) + +int main(void) +{ + int xy = 42; + printf("%d\n", CAT(A,B)(x)); + return 0; +} diff --git a/tests/tests2/64_macro_nesting.expect b/tests/tests2/64_macro_nesting.expect new file mode 100644 index 00000000..d81cc071 --- /dev/null +++ b/tests/tests2/64_macro_nesting.expect @@ -0,0 +1 @@ +42 diff --git a/tests/tests2/Makefile b/tests/tests2/Makefile index 4d5546d3..36d84dca 100644 --- a/tests/tests2/Makefile +++ b/tests/tests2/Makefile @@ -78,7 +78,8 @@ TESTS = \ 60_enum_redefinition.test \ 61_undefined_enum.test \ 62_enumerator_redefinition.test \ - 63_local_enumerator_redefinition.test + 63_local_enumerator_redefinition.test \ + 64_macro_nesting.test # 30_hanoi.test -- seg fault in the code, gcc as well # 34_array_assignment.test -- array assignment is not in C standard -- 2.11.4.GIT