summaryrefslogtreecommitdiff
path: root/Lib/test/test_shlex.py
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2017-01-15 10:06:52 +0000
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2017-01-15 10:06:52 +0000
commit61eda7260ac9fcdb6c5f066eb48dc344544bdfa6 (patch)
tree9beae3f1525cc5b9e43774bcdc62dd23950988fb /Lib/test/test_shlex.py
parent2e1b6ea4b7b2ca2c9deab8bc7737b1337bdb192a (diff)
downloadcpython-git-61eda7260ac9fcdb6c5f066eb48dc344544bdfa6.tar.gz
Fixed #29132: Updated shlex to work better with punctuation chars in POSIX mode.
Thanks to Evan_ for the report and patch.
Diffstat (limited to 'Lib/test/test_shlex.py')
-rw-r--r--Lib/test/test_shlex.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_shlex.py b/Lib/test/test_shlex.py
index 3936c97c8b..fd35788e81 100644
--- a/Lib/test/test_shlex.py
+++ b/Lib/test/test_shlex.py
@@ -273,6 +273,14 @@ class ShlexTest(unittest.TestCase):
# white space
self.assertEqual(list(s), ['a', '&&', 'b', '||', 'c'])
+ def testPunctuationWithPosix(self):
+ """Test that punctuation_chars and posix behave correctly together."""
+ # see Issue #29132
+ s = shlex.shlex('f >"abc"', posix=True, punctuation_chars=True)
+ self.assertEqual(list(s), ['f', '>', 'abc'])
+ s = shlex.shlex('f >\\"abc\\"', posix=True, punctuation_chars=True)
+ self.assertEqual(list(s), ['f', '>', '"abc"'])
+
def testEmptyStringHandling(self):
"""Test that parsing of empty strings is correctly handled."""
# see Issue #21999