Flowdock
module
Importance_2
Ruby latest stable (v1_9_3_392) - 0 notes

Coverage provides coverage measurement feature for Ruby. This feature is experimental, so these APIs may be changed in future.

Usage

(1) require “coverage.so” (2) do Coverage.start (3) require or load Ruby source file (4) Coverage.result will return a hash that contains filename as key and

coverage array as value.

Example

[foo.rb]
s = 0
10.times do |x|
  s += x
end

if s == 45
  p :ok
else
  p :ng
end
[EOF]

require "coverage.so"
Coverage.start
require "foo.rb"
p Coverage.result  #=> {"foo.rb"=>[1, 1, 10, nil, nil, 1, 1, nil, 0, nil]}
Show files where this module is defined (1 file)
Register or log in to add new notes.