diff options
author | Petri Lehtinen <petri@digip.org> | 2013-02-23 21:11:06 (GMT) |
---|---|---|
committer | Petri Lehtinen <petri@digip.org> | 2013-02-23 21:11:06 (GMT) |
commit | 978b4d6d295934c6ded26a3329dfe72bc9d69bc9 (patch) | |
tree | 1529a08a62d074888ce800f1d2182a793f13327c /Lib/test | |
parent | 3ef11a98c640d9f014ca73999fd0d436a6c1789a (diff) | |
parent | 6d61eaa0d0d89b0e035ce75d810280515befc17a (diff) | |
download | cpython-978b4d6d295934c6ded26a3329dfe72bc9d69bc9.zip cpython-978b4d6d295934c6ded26a3329dfe72bc9d69bc9.tar.gz cpython-978b4d6d295934c6ded26a3329dfe72bc9d69bc9.tar.bz2 |
Issue #16121: Fix line number accounting in shlex
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_shlex.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_shlex.py b/Lib/test/test_shlex.py index d4463f30..5f7b68f 100644 --- a/Lib/test/test_shlex.py +++ b/Lib/test/test_shlex.py @@ -189,6 +189,14 @@ class ShlexTest(unittest.TestCase): self.assertEqual(shlex.quote("test%s'name'" % u), "'test%s'\"'\"'name'\"'\"''" % u) + def testLineNumbers(self): + data = '"a \n b \n c"\n"x"\n"y"' + for is_posix in (True, False): + s = shlex.shlex(data, posix=is_posix) + for i in (1, 4, 5): + s.read_token() + self.assertEqual(s.lineno, i) + # Allow this test to be used with old shlex.py if not getattr(shlex, "split", None): |