Project

General

Profile

Actions

Bug #15476

closed

Branch coverage: Failing to load trivial sample when branch coverage is on

Added by MaxLap (Maxime Lapointe) over 5 years ago. Updated over 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux]
[ruby-core:90764]

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

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0