[ruby-core:91070] [Ruby trunk Bug#15476] Branch coverage: Failing to load trivialsample when branch coverage is on

From: naruse@...
Date: 2019-01-14 06:34:20 UTC
List: ruby-core #91070
Issue #15476 has been updated by naruse (Yui NARUSE).

Backport changed from 2.4: DONTNEED, 2.5: DONTNEED, 2.6: REQUIRED to 2.4: DONTNEED, 2.5: DONTNEED, 2.6: DONE

ruby_2_6 r66813 merged revision(s) 66670,66676.

----------------------------------------
Bug #15476: Branch coverage: Failing to load trivial sample when branch coverage is on
https://bugs.ruby-lang.org/issues/15476#change-76294

* Author: MaxLap (Maxime Lapointe)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux]
* Backport: 2.4: DONTNEED, 2.5: DONTNEED, 2.6: DONE
----------------------------------------
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.

~~~ ruby
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




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next