aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Preud'homme <robotux@celest.fr>2014-04-07 23:30:57 +0800
committerThomas Preud'homme <robotux@celest.fr>2014-04-07 23:30:57 +0800
commit91d4db600bd95318c224100f13b79de9fdd5ca79 (patch)
tree11e8b29a5aed9e578a2db675f7f55a7c5f3efd12
parentc2422ba87fb8ad322f0ef6ac47ee9f996a876c06 (diff)
downloadtinycc-91d4db600bd95318c224100f13b79de9fdd5ca79.tar.gz
tinycc-91d4db600bd95318c224100f13b79de9fdd5ca79.tar.bz2
Add new tests for macro nesting
-rw-r--r--tests/tests2/64_macro_nesting.c10
-rw-r--r--tests/tests2/64_macro_nesting.expect1
-rw-r--r--tests/tests2/Makefile3
3 files changed, 13 insertions, 1 deletions
diff --git a/tests/tests2/64_macro_nesting.c b/tests/tests2/64_macro_nesting.c
new file mode 100644
index 0000000..44b582f
--- /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 0000000..d81cc07
--- /dev/null
+++ b/tests/tests2/64_macro_nesting.expect
@@ -0,0 +1 @@
+42
diff --git a/tests/tests2/Makefile b/tests/tests2/Makefile
index 4d5546d..36d84dc 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