Skip to content

Commit

Permalink
Consider continued lines as executable (#68)
Browse files Browse the repository at this point in the history
This is useful when considering diff coverage.
  • Loading branch information
blueyed authored Feb 10, 2019
1 parent 9841e63 commit ab335d2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 2 additions & 0 deletions covimerage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,8 @@ def skip_to_count_header():
source_line = line[28:]

if in_script:
if count is None and RE_CONTINUING_LINE.match(source_line):
count = in_script.lines[lnum-1].count
in_script.lines[lnum] = Line(
line=source_line, count=count,
total_time=total_time, self_time=self_time)
Expand Down
2 changes: 1 addition & 1 deletion covimerage/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from ._compat import shell_quote

# Empty (whitespace only), comments, continued, or `end` statements.
RE_NON_EXECED = re.compile(r'^\s*("|\\|end|$)')
RE_NON_EXECED = re.compile(r'^\s*("|end|$)')


def get_fname_and_fobj_and_str(fname_or_fobj):
Expand Down
5 changes: 2 additions & 3 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,12 @@ def test_profile_continued_lines():
assert len(p.scripts) == 1
s = p.scripts[0]

N = None
assert [(l.count, l.line) for l in s.lines.values()] == [
(1, 'echom 1'),
(1, 'echom 2'),
(N, ' \\ 3'),
(1, ' \\ 3'),
(1, 'echom 4'),
(N, ' \\ 5'),
(1, ' \\ 5'),
]


Expand Down

0 comments on commit ab335d2

Please sign in to comment.