summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEfimov Vasily <real@ispras.ru>2017-10-30 19:12:58 +0300
committerEfimov Vasily <real@ispras.ru>2017-10-30 19:35:50 +0300
commit9fdca0bf6ae95e0dc4d8e93f22256e7c90f28f6e (patch)
tree23f9655b47093dcd020e6144ee64785ec6a86b91
parent1fd7e1222c6c93678b9dee56cac972b51b5abc97 (diff)
downloadply-9fdca0bf6ae95e0dc4d8e93f22256e7c90f28f6e.tar.gz
test: add example of incorrect expansion of concatenation (##) in macro
Signed-off-by: Efimov Vasily <real@ispras.ru>
-rw-r--r--test/testcpp.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/testcpp.py b/test/testcpp.py
index 2582c03..51508c4 100644
--- a/test/testcpp.py
+++ b/test/testcpp.py
@@ -45,4 +45,27 @@ class CPPTests(TestCase):
else:
self.assertMultiLineEqual(out, expected)
+ def test_concatenation(self):
+ self.__test_preprocessing("""\
+#define a(x) x##_
+#define b(x) _##x
+#define c(x) _##x##_
+#define d(x,y) _##x##y##_
+
+a(i)
+b(j)
+c(k)
+d(q,s)"""
+ , """\
+
+
+
+
+
+i_
+_j
+_k_
+_qs_"""
+ )
+
main()