diff options
author | Georg Brandl <georg@python.org> | 2008-12-05 09:23:14 +0000 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-12-05 09:23:14 +0000 |
commit | a07435d3e3dfee3e4d8998baa7fadbfaf46f764d (patch) | |
tree | 1c749e787fde8e79d694630fcf18679835613d1a /Lib/test/test_getopt.py | |
parent | 8d6c49047f2725ebb67212689e7eef2388dfbcdc (diff) | |
download | cpython-git-a07435d3e3dfee3e4d8998baa7fadbfaf46f764d.tar.gz |
#4458: recognize "-" as an argument, not a malformed option in gnu_getopt().
Diffstat (limited to 'Lib/test/test_getopt.py')
-rw-r--r-- | Lib/test/test_getopt.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_getopt.py b/Lib/test/test_getopt.py index 36d1688b03..aac720d5a6 100644 --- a/Lib/test/test_getopt.py +++ b/Lib/test/test_getopt.py @@ -124,6 +124,11 @@ class GetoptTests(unittest.TestCase): self.assertEqual(opts, [('-a', ''), ('-b', '1'), ('--alpha', ''), ('--beta', '2')]) + # recognize "-" as an argument + opts, args = getopt.gnu_getopt(['-a', '-', '-b', '-'], 'ab:', []) + self.assertEqual(args, ['-']) + self.assertEqual(opts, [('-a', ''), ('-b', '-')]) + # Posix style via + opts, args = getopt.gnu_getopt(cmdline, '+ab:', ['alpha', 'beta=']) self.assertEqual(opts, [('-a', '')]) |