From: Han-Wen Nienhuys Date: Wed, 3 Jan 2007 20:10:15 +0000 (+0100) Subject: coverage.py improvements. X-Git-Tag: release/2.11.9-1~51 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=75dfb90312313a05d40da464e42a847f9565e874;p=lilypond.git coverage.py improvements. --- diff --git a/buildscripts/coverage.py b/buildscripts/coverage.py index f4397e10e0..415c7100ff 100644 --- a/buildscripts/coverage.py +++ b/buildscripts/coverage.py @@ -79,9 +79,28 @@ def is_exception_chunk (ch): return True return False +def widen_chunk (ch, ls): + nums = [n-1 for (n, l) in ch] + (a, b) = (min (nums), max (nums)+1) + a -= 1 + b += 1 + + return [(n, l) for (c, n, l) in ls[a:b]] + + +def is_inspection_chunk (ch): + for (n,l) in ch: + for stat in ('::print',): + if stat in l: + return True + return False + def print_chunk (ch, lines): nums = [n-1 for (n, l) in ch] - for (c, n, l) in lines[min (nums):max (nums)+1]: + (a, b) = (min (nums), max (nums)+1) + a -= 1 + b += 1 + for (c, n, l) in lines[a:b]: sys.stdout.write ('%8s:%8d:%s' % (c,n,l)) @@ -93,8 +112,9 @@ def extract_uncovered (file): return cs = get_chunks (ls) + cs = [widen_chunk(c, ls) for c in cs] cs = [c for c in cs if not is_exception_chunk (c)] - print '\n'.join (['%d' % x for (a,x,b) in ls]) + cs = [c for c in cs if not is_inspection_chunk (c)] for c in cs: print 'Uncovered chunk in', file print_chunk (c, ls)