Last active
December 18, 2015 19:00
-
-
Save colszowka/5830082 to your computer and use it in GitHub Desktop.
Quick demo of the problem of resetting Ruby STDLIB's Coverage mid-way
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# On "ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-linux]", but should be the same on all 1.9+ | |
require 'coverage' | |
Coverage.start | |
require './foo' | |
puts Coverage.result | |
# {"foo.rb"=>[1, 1, 0, nil, nil, 1, 0, nil, nil]} | |
Coverage.start | |
Foo.new.bar | |
puts Coverage.result | |
# {"foo.rb"=>[]} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
def bar | |
:bar | |
end | |
def baz | |
:baz | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment