From ac06f346272c0bdf2bc18aa4f41b50a827e40d34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 27 Nov 2011 15:24:13 +0100 Subject: [PATCH] extracttests.py: cleaned up the code for parsing of command line --- tools/extracttests.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tools/extracttests.py b/tools/extracttests.py index 81c7be48c..2851a300e 100755 --- a/tools/extracttests.py +++ b/tools/extracttests.py @@ -124,7 +124,7 @@ def writeHtmlFile(nodes, functionName, filename, errorsOnly): fout.close() -if len(sys.argv) == 1 or '--help' in sys.argv: +if len(sys.argv) <= 1 or '--help' in sys.argv: print 'Extract test cases from test file' print 'Syntax: extracttests.py [--html=folder] [--xml] path/testfile.cpp' sys.exit(0) @@ -133,16 +133,14 @@ if len(sys.argv) == 1 or '--help' in sys.argv: xml = False filename = None htmldir = None -i = 1 -while i < len(sys.argv): - if sys.argv[i] == '--xml': +for arg in sys.argv[1:]: + if arg == '--xml': xml = True - elif sys.argv[i].startswith('--html='): - arg = sys.argv[i] + elif arg.startswith('--html='): htmldir = arg[7:] else: - filename = sys.argv[i] - i = i + 1 + filename = arg + # extract test cases if filename != None: