diff options
author | Mike Frysinger <vapier@gentoo.org> | 2015-04-04 17:23:44 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2015-04-04 17:23:44 -0400 |
commit | 56cf23ea1bd90f9f850691dbf2052cd58aa99a98 (patch) | |
tree | 7d4e0d2cbbb8cb4274043c90ce55db3a33d3eab7 | |
parent | ekeyword: fix unused variable warnings (diff) | |
download | gentoolkit-56cf23ea1bd90f9f850691dbf2052cd58aa99a98.tar.gz gentoolkit-56cf23ea1bd90f9f850691dbf2052cd58aa99a98.tar.bz2 gentoolkit-56cf23ea1bd90f9f850691dbf2052cd58aa99a98.zip |
ekeyword: fix crash when passing "" as the archgentoolkit-dev-0.3.0
-rwxr-xr-x | src/ekeyword/ekeyword.py | 2 | ||||
-rwxr-xr-x | src/ekeyword/ekeyword_unittest.py | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/ekeyword/ekeyword.py b/src/ekeyword/ekeyword.py index b0035da..7a0cc7d 100755 --- a/src/ekeyword/ekeyword.py +++ b/src/ekeyword/ekeyword.py @@ -478,7 +478,7 @@ def main(argv): if arg in ('--format',): if argv: parse_args.append(argv.pop(0)) - elif arg[0] == '-' and len(arg) == 2: + elif len(arg) == 2 and arg[0] == '-': parse_args.append(arg) else: work_args.append(arg) diff --git a/src/ekeyword/ekeyword_unittest.py b/src/ekeyword/ekeyword_unittest.py index 5141159..134dd80 100755 --- a/src/ekeyword/ekeyword_unittest.py +++ b/src/ekeyword/ekeyword_unittest.py @@ -372,6 +372,10 @@ class TestMain(unittest.TestCase): ekeyword.main(['arm', '--dry-run', os.path.join(TESTDIR, 'process-1.ebuild')]) ekeyword.main(['--version', '--dry-run']) + def testEmptyString(self): + self.assertRaises(SystemExit, ekeyword.main, + ['', os.path.join(TESTDIR, 'process-1.ebuild')]) + if __name__ == '__main__': unittest.main() |