Issue #15475 has been reported by MaxLap (Maxime Lapointe).

----------------------------------------
Bug #15475: Branch coverage not including csend of assignations
https://bugs.ruby-lang.org/issues/15475

* Author: MaxLap (Maxime Lapointe)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.6.0
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
In the following code, only the first conditional call will appear in the result hash of the branch coverage. The second one will not because it is a setter. This appears to be a forgotten case for branch coverage.

~~~ ruby
require 'tempfile'
f = Tempfile.new(['ruby', '.rb'])
f.write(<<-RUBY)
  a = nil
  a&.just_a_call

  a&.now_a_setter = something
RUBY
f.close

require 'coverage'
Coverage.start(branches: true)
load f.path

puts Coverage.result
# => {"/tmp/ruby20181227-1959-1rb8s2n.rb"
#       => {:branches=>{[:"&.", 0, 2, 2, 2, 16]=>{[:then, 1, 2, 2, 2, 16]=>0, [:else, 2, 2, 2, 2, 16]=>1}}}}

~~~

This was there in 2.5 and is still there 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>