Project

General

Profile

« Previous | Next » 

Revision 68394b27

Added by mame (Yusuke Endoh) almost 8 years ago

[EXPERIMENTAL] Extend the API of Coverage.start and result

The old API:

Coverage.start
load "foo.rb"
p Coverage.result #=> {"foo.rb" => [1, 2, nil]}

The new API:

ENV["COVERAGE_EXPERIMENTAL_MODE"] = "true"
Coverage.start(lines: true)
load "foo.rb"
p Coverage.result #=> {"foo.rb" => {:lines => [1, 2, nil]}}

This new API allows us to add other measuring target types.

Notes:

  • To keep compatibility, the old interface is still remained; passing no
    optional argument makes Coverage.result return the old format.
  • This feature is still experimental. So, to enable the new API, the
    environment variable COVERAGE_EXPERIMENTAL_MODE must be set. I plan
    to activate this feature by Ruby 2.5.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e