diff options
author | Petri Lehtinen <petri@digip.org> | 2013-02-23 21:09:51 (GMT) |
---|---|---|
committer | Petri Lehtinen <petri@digip.org> | 2013-02-23 21:09:51 (GMT) |
commit | 6d61eaa0d0d89b0e035ce75d810280515befc17a (patch) | |
tree | 56e10b05f3fc2465b1dfb6a6b5ac4fc3b93b2f1c /Lib/test/test_shlex.py | |
parent | 7de72ad8a02760e0aa385e9024d6c20d7b1fb3de (diff) | |
parent | 7a05113ccf76b077b138d40794e52f6881a57c4c (diff) | |
download | cpython-6d61eaa0d0d89b0e035ce75d810280515befc17a.zip cpython-6d61eaa0d0d89b0e035ce75d810280515befc17a.tar.gz cpython-6d61eaa0d0d89b0e035ce75d810280515befc17a.tar.bz2 |
Issue #16121: Fix line number accounting in shlex
Diffstat (limited to 'Lib/test/test_shlex.py')
-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): |