]> granicus.if.org Git - python/commitdiff
Add test case for SF bug
authorTim Peters <tim.peters@gmail.com>
Wed, 27 Dec 2000 08:03:20 +0000 (08:03 +0000)
committerTim Peters <tim.peters@gmail.com>
Wed, 27 Dec 2000 08:03:20 +0000 (08:03 +0000)
https://sourceforge.net/bugs/?func=detailbug&bug_id=126863&group_id=5470

Lib/test/test_getopt.py

index 3927c1c31e3860b475f7a933e464c76d2c0dbd34..146020059354cbb99e78ddb068a4e6fc3f7d2298 100644 (file)
@@ -74,6 +74,15 @@ assert args == []
 opts, args = getopt.do_longs([], 'abc=1', ['abcd='], [])
 assert opts == [('--abcd', '1')]
 assert args == []
+opts, args = getopt.do_longs([], 'abc', ['ab', 'abc', 'abcd'], [])
+assert opts == [('--abc', '')]
+assert args == []
+# Much like the preceding, except with a non-alpha character ("-") in
+# option name that precedes "="; failed in
+# http://sourceforge.net/bugs/?func=detailbug&bug_id=126863&group_id=5470
+opts, args = getopt.do_longs([], 'foo=42', ['foo-bar', 'foo=',], [])
+assert opts == [('--foo', '42')]
+assert args == []
 expectException("opts, args = getopt.do_longs([], 'abc=1', ['abc'], [])",
                 GetoptError)
 expectException("opts, args = getopt.do_longs([], 'abc', ['abc='], [])",