Repository navigation
Fix line coverage of statements inside string interpolation and heredocs #9682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
61e7053
Fix line coverage of statements inside string interpolation and heredocs
sferik 23e7904
Only uncover a line the lone interpolated statement marked itself
sferik efcfd21
Count a statement whose value holds statements of its own
sferik b8097c3
Keep a statement's coverage count on the statement's line
sferik 3c5d9d4
Give multi-line literals the line they start on
sferik 50150b4
Count line coverage on the line of a statement's first instruction
sferik f7cb395
Size line coverage past a heredoc that ends the file
sferik 16e0223
Give an undef statement the line of its undef keyword
sferik 84a62b7
Make each arm of a ternary a line event
sferik bb9bcfe
Run the MRI oneshot_lines coverage test
sferik 281bcb2
Give Coverage.line_stub an entry for every line of the file
sferik 9ad177e
Keep IRBuilder's line coverage state in a LineNumberInfo
sferik b22bd97
Use CRuby's helpers for node locations in the grammar
sferik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Give Coverage.line_stub an entry for every line of the file
The loop that padded the stub with nils compared against lines.size(), which grows as the loop appends, so it stopped about halfway to the end: a five-line method whose last statement is on line 2 got a four-entry stub. A last line with no newline was not counted at all. Pad until the stub has one entry per line, counting lines as File.foreach does, which is what CRuby's line_stub sizes its array by. SimpleCov builds the line coverage of files that were never loaded from line_stub, so those files were reported with lines missing. An empty file could still get a stub of [0]. Every parse shares the NilImplicitNode.NIL singleton, and an if with an empty else as the last statement of a block marked it as a newline through fixpos, so from then on the implicit nil at the root of an empty file counted as a line. Make NIL ignore setNewline and setLine so no parse can change it for later ones.
- Loading branch information
commit 281bcb23b6d98fab8d295d28a749a5ce94e40a1e
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.