Tell RCov to Cov Off

Posted by: Aaron Bedra on 10/16/2009

Tell RCov to Cov Off

16 Oct 2009

Chad and I just released a new version of RCov! This version offers the ability to tell RCov to ignore certain pieces of code. This is useful if you are experiencing an bug in RCov, or if you just plain old disagree with RCov about the coverage status of a particular chunk of code. Here’s an example of implementation:

class Foo
  def bar
    1 + 2
  end

  #:nocov:
  def quux
    "s" + "hit"
  end
  #:nocov:

end

require 'test/unit'
class FooTest < Test::Unit::TestCase
  def test_bar
    assert_equal 3, Foo.new.bar
  end
end

Running this will show you 100% code coverage. This feature (for now) is pretty simple and does not do anything more than tell RCov to count the code as covered. If this feature takes off, I will spend more time making it smarter about the code and reporting so that you can easily tell the difference.


About Aaron Bedra

Aaron Bedra

Aaron Bedra is a member of Clojure/core and a developer at Relevance, Inc. where he spends his time as a tech lead, speaker and author. He is a frequent contributor to the Clojure language and its supporting libraries as well as an active member of the Clojure community. Aaron has led the development of several commercial Clojure projects and is the co-author with Stuart Halloway of Programming Clojure, 2nd Edition.

More About Aaron »

Why Attend the NFJS Tour?

  • » Cutting-Edge Technologies
  • » Agile Practices
  • » Peer Exchange

Current Topics:

  • Languages on the JVM: Scala, Groovy, Clojure
  • Enterprise Java
  • Core Java, Java 7
  • Agility
  • Testing: Geb, Spock, Easyb
  • REST
  • NoSQL: MongoDB, Cassandra
  • Hadoop
  • Spring 3
  • Automation Tools: Git, Hudson, Sonar
  • HTML5, Ajax, jQuery, Usability
  • Mobile Applications - iPhone and Android
  • More...
Learn More »

NFJS, the Magazine

December Issue Now Available
  • BDD and REST

    by Brian Sletten
  • Mocks and Stubs in Groovy Tests

    by Kenneth Kousen
  • Algorithms for Better Text Search Results

    by John Griffin
  • Knowns and Unknowns of Scrum and Agile

    by Brian Tarbox
Learn More »