summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEli Bendersky <eliben@gmail.com>2020-09-30 06:42:17 -0700
committerEli Bendersky <eliben@gmail.com>2020-09-30 06:42:17 -0700
commitcc49de6cd75425f09502d592c21f8c0dd134ed9f (patch)
tree3ff99eebe0aa85a8c35078101882d11d42f4023a /tests
parentc730829b450fa242cf46f646e51061342a2d4a39 (diff)
downloadpycparser-cc49de6cd75425f09502d592c21f8c0dd134ed9f.tar.gz
Add test for https://github.com/eliben/pycparser/issues/392
[no fix yet]
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test_c_parser.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_c_parser.py b/tests/test_c_parser.py
index d33941c..f9f5281 100755
--- a/tests/test_c_parser.py
+++ b/tests/test_c_parser.py
@@ -1503,6 +1503,16 @@ class TestCParser_fundamentals(TestCParser_base):
d5 = self.get_decl_init(r'char* s = "foo\"" "bar";')
self.assertEqual(d5, ['Constant', 'string', r'"foo\"bar"'])
+ # This is not correct based on the the C spec, but testing it here to
+ # see the behavior in action. Will have to fix this
+ # for https://github.com/eliben/pycparser/issues/392
+ #
+ # The spec says in section 6.4.5 that "escape sequences are converted
+ # into single members of the execution character set just prior to
+ # adjacent string literal concatenation".
+ d6 = self.get_decl_init(r'char* s = "\1" "23";')
+ self.assertEqual(d6, ['Constant', 'string', r'"\123"'])
+
def test_unified_wstring_literals(self):
d1 = self.get_decl_init('char* s = L"hello" L"world";')
self.assertEqual(d1, ['Constant', 'string', 'L"helloworld"'])