summaryrefslogtreecommitdiff
path: root/test/coverage
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-23 15:44:26 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-23 15:44:26 +0000
commit54163e2b52559d8c996607c0df635743d47af81b (patch)
treedc32837d91955c2082855863df9b05f09c5ded32 /test/coverage
parenta14e13b23bea72ed78181f752eb6e9454b10eb9a (diff)
* thread.c (update_coverage): skip coverage count up if the current
line is out of the way. rb_sourceline() is unreliable when source code is big. [ruby-dev:44413] * test/coverage/test_coverage.rb: add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/coverage')
-rw-r--r--test/coverage/test_coverage.rb25
1 files changed, 23 insertions, 2 deletions
diff --git a/test/coverage/test_coverage.rb b/test/coverage/test_coverage.rb
index 56966b1..4d785c3 100644
--- a/test/coverage/test_coverage.rb
+++ b/test/coverage/test_coverage.rb
@@ -31,10 +31,31 @@ class TestCoverage < Test::Unit::TestCase
Coverage.start
require tmp + '/test.rb'
- Coverage.result
+ assert_equal 3, Coverage.result[tmp + '/test.rb'].size
Coverage.start
coverage_test_method
- assert_equal 1, Coverage.result.size
+ assert_equal 0, Coverage.result[tmp + '/test.rb'].size
+ }
+ }
+ ensure
+ $".replace loaded_features
+ end
+
+ def test_big_code
+ loaded_features = $".dup
+
+ Dir.mktmpdir {|tmp|
+ Dir.chdir(tmp) {
+ File.open("test.rb", "w") do |f|
+ f.puts "p\n" * 10000
+ f.puts "def ignore(x); end"
+ f.puts "ignore([1"
+ f.puts "])"
+ end
+
+ Coverage.start
+ require tmp + '/test.rb'
+ assert_equal 10003, Coverage.result[tmp + '/test.rb'].size
}
}
ensure