On Tue, Mar 14, 2006 at 09:27:14AM +0900, David Holroyd wrote:
> On Wed, Mar 01, 2006 at 01:31:11AM +0900, Mauricio Fernandez wrote:
> > Source code, additional information, screenshots... available at 
> > 
> >     http://eigenclass.org/hiki.rb?rcov
> 
> Fabulous!
> 
> I would like to get coverage for my test cases too.  Could this be
> accomodated (without tweaking @ignore_files in the source)?

It will be possible in the next release; in the meantime, could you use the
following patch?


--- old-rcov/bin/rcov 2006-03-14 18:12:47.000000000 +0100 +++ new-rcov/bin/rcov 2006-03-14 09:53:07.000000000 +0100 @@ -790,6 +790,11 @@ regexps = list.split(/,/).map{|x| Regexp.new x} options.skip += regexps end + opts.on("--exclude-only PATTERNS", + "Skip info generation only for the files matching the", + "given patterns (i.e. discard the default regexp list).") do |list| + options.skip = list.split(/,/).map{|x| Regexp.new(x) } + end opts.on("-p", "--profile", "Generate bogo-profiling info.") do options.profiling = true options.destdir ||= "profiling"
After applying: (note that in rcov 0.2.0 -n == --no-color is ignored in -T rich-text mode, so you'll get ANSI-decorated output instead of the following) $ rcov --exclude-only lib/ruby --no-html -n -T tc_foo.rb Loaded suite tc_foo Started 6 . Finished in 0.009056 seconds. 1 tests, 1 assertions, 0 failures, 0 errors ================================================================================ ./tc_foo.rb ================================================================================ require 'test/unit' require 'foo' class TC_Foo < Test::Unit::TestCase def setup; @foo = Foo.new end def test_foo assert_equal(8, @foo.foo(2, 4)) end end ================================================================================ ./foo.rb ================================================================================ class Foo def foo(a,b) if b > 3 puts a + b ## else ## puts a - b ## end a * b end end class Bar def bar ## 1 ## end ## end ## -- Mauricio Fernandez - http://eigenclass.org - singular Ruby