Rcov limitation

When using rcov to measure the code coverage of the following:

2 Symbol.class_eval do
3 def to_proc
4 lambda {|obj, *args| obj.send(self, *args) }
5 end
6 end

it erroneously reports that lines 4 - 6 have not been executed when
executing a set of test cases via:

rake rcov

However, if I use rcov to drive only the one test case that exercises
the above code via:

rcov -I/my_lib_path tc_utility.rb

it correctly show lines 4 - 6 as being executed.

Anyone know why rcov might have a problem detecting this when running
a set of files instead of an individual?

My Rakefile includes the following for the rcov task:

lib_dir = [ File.expand_path(’…’) ]

Rcov::RcovTask.new do |t|
t.libs = lib_dir
t.test_files = FileList[‘tc_*.rb’]
t.verbose = true
end

Brian A.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs