summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_getopt.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_getopt.py')
-rw-r--r--Lib/test/test_getopt.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_getopt.py b/Lib/test/test_getopt.py
index 36d1688..aac720d 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', '')])