From 712ca42985e8a1999943f32068d4950101b295cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 2 Dec 2011 18:33:17 +0100 Subject: [PATCH] extracttests: refactorings. dont include dynamic strings in the listing --- tools/extracttests.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tools/extracttests.py b/tools/extracttests.py index 4f90aefda..768ab4af9 100755 --- a/tools/extracttests.py +++ b/tools/extracttests.py @@ -1,18 +1,27 @@ #!/usr/bin/python -"""Extract test cases information from Cppcheck test file""" +""" +Extract test cases information from Cppcheck test +file +""" import sys import re class Extract: - """Read Cppcheck test file and create data representation""" + """ + Read Cppcheck test file and create data + representation + """ # array that stores all the test cases nodes = [] def parseFile(self,filename): - """parse test file and add info to the nodes variable""" + """ + parse test file and add info to the nodes + variable + """ name = '[0-9a-zA-Z_]+' string = '\\"(.+)\\"' @@ -43,7 +52,7 @@ class Extract: continue # check - res = re.match('\s+check\('+string, line) + res = re.match('\s+check.*\('+string, line) if res != None: code = res.group(1) @@ -53,7 +62,7 @@ class Extract: code = code + res.group(1) # assert - res = re.match('\\s+ASSERT_EQUALS\\(\\"(.*)\\"', line) + res = re.match('\\s+ASSERT_EQUALS\\(\\"([^"]*)\\",', line) if res != None and len(code) > 10: node = { 'testclass':testclass, 'functionName':functionName,