From 680ec04b53e638e25b400669412bee9917229de4 Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Fri, 29 Jul 2011 14:06:02 +0000 Subject: [PATCH] Fixed regex bug in script for java tests coverage calculation --- modules/java/check-tests.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/java/check-tests.py b/modules/java/check-tests.py index cdb3edf..6fdf0c7 100644 --- a/modules/java/check-tests.py +++ b/modules/java/check-tests.py @@ -20,7 +20,7 @@ class JavaParser: self.tdict = {} self.empty_stubs_cnt = 0 self.r1 = re.compile("\s*public\s+(?:static\s+)?(\w+)\(([^)]*)\)") # c-tor - self.r2 = re.compile("\s*public\s+(?:static\s+)?\w+\s+(\w+)\(([^)]*)\)") + self.r2 = re.compile("\s*(?:(?:public|static|final)\s+){1,3}\S+\s+(\w+)\(([^)]*)\)") self.r3 = re.compile('\s*fail\("Not yet implemented"\);') # empty test stub @@ -77,12 +77,16 @@ class JavaParser: func = m1.group(1) args_str = m1.group(2) elif m2: + if "public" not in line: + continue func = m2.group(1) args_str = m2.group(2) elif m3: self.empty_stubs_cnt += 1 continue else: + #if "public" in line: + #print "UNRECOGNIZED: " + line continue d = (self.mdict, self.tdict)["test" in func] func = re.sub(r"^test", "", func) -- 2.7.4