Actions
Bug #15476
closedBranch coverage: Failing to load trivial sample when branch coverage is on
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux]
Description
The following will fail (for the second #load) on 2.6.0
I assume this is Ruby removing useless code, and the branch coverage code handling it incorrectly.
require 'tempfile'
f = Tempfile.new(['ruby', '.rb'])
f.write(<<-RUBY)
nil&.map { |i| i }
RUBY
f.close
require 'coverage'
load f.path
puts 'Without coverage worked'
Coverage.start(branches: true)
load f.path
puts 'With coverage worked'
This problem was not present in 2.5, but appeared in 2.6
Actions
Like0
Like0Like0Like0Like0Like0Like0Like0