Skip to content

Commit

Permalink
Merge pull request #21 from lbraun/master
Browse files Browse the repository at this point in the history
Don't add ellipsis if line groups have not been truncated
  • Loading branch information
chetan authored Feb 1, 2021
2 parents 3ac0a95 + 5e266d0 commit 869bf9f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/simplecov-console.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,9 @@ def missed(missed_lines)
end
end

if SimpleCov::Formatter::Console.max_lines > 0 then
# show at most N missing groups of lines
max_lines = SimpleCov::Formatter::Console.max_lines
if max_lines > 0 && group_str.size > max_lines then
# Show at most N missing groups of lines
group_str = group_str[0, SimpleCov::Formatter::Console.max_lines] << "..."
end

Expand Down
4 changes: 4 additions & 0 deletions test/test_simplecov-console.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ def test_max_missed
Line.new(3), Line.new(5)]
expected_result = ["1-3", "..."]
assert_equal expected_result, @console.missed(missed_lines)

SimpleCov::Formatter::Console.max_lines = 3
expected_result = ["1-3", "5"]
assert_equal expected_result, @console.missed(missed_lines)
end

def test_table_output
Expand Down

0 comments on commit 869bf9f

Please sign in to comment.