summaryrefslogtreecommitdiff
path: root/test/coverage/test_coverage.rb
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-05 08:56:51 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-05 08:56:51 +0000
commitf6556c5c398190d21e59ce23ff814c6116fbd27e (patch)
tree57a63588afc048fc3218c707477fda3de24e327b /test/coverage/test_coverage.rb
parenta5e02f249d398df2d3861f99ba9754061db562ff (diff)
ext/coverage/coverage.c: method coverage has column info. of method def.
This change makes method coverage result have not only first lineno of method defintion, but also code range (i.e. first lineno, first column, last lineno, and last column). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/coverage/test_coverage.rb')
-rw-r--r--test/coverage/test_coverage.rb36
1 files changed, 18 insertions, 18 deletions
diff --git a/test/coverage/test_coverage.rb b/test/coverage/test_coverage.rb
index b361d8b..8fdef0d 100644
--- a/test/coverage/test_coverage.rb
+++ b/test/coverage/test_coverage.rb
@@ -340,16 +340,16 @@ class TestCoverage < Test::Unit::TestCase
def test_method_coverage
result = {
:methods => {
- [Object, :bar, 2] => 1,
- [Object, :baz, 4] => 0,
- [Object, :foo, 1] => 2,
+ [Object, :bar, 2, 0, 3, 3] => 1,
+ [Object, :baz, 4, 1, 4, 13] => 0,
+ [Object, :foo, 1, 0, 1, 12] => 2,
}
}
- assert_coverage(<<-"end;", { methods: true }, result)
+ assert_coverage(<<~"end;", { methods: true }, result)
def foo; end
def bar
end
- def baz; end
+ def baz; end
foo
foo
@@ -360,12 +360,12 @@ class TestCoverage < Test::Unit::TestCase
def test_method_coverage_for_define_method
result = {
:methods => {
- [Object, :bar, 2] => 1,
- [Object, :baz, 4] => 0,
- [Object, :foo, 1] => 2,
+ [Object, :bar, 2, 20, 3, 1] => 1,
+ [Object, :baz, 4, 9, 4, 11] => 0,
+ [Object, :foo, 1, 20, 1, 22] => 2,
}
}
- assert_coverage(<<-"end;", { methods: true }, result)
+ assert_coverage(<<~"end;", { methods: true }, result)
define_method(:foo) {}
define_method(:bar) {
}
@@ -387,7 +387,7 @@ class TestCoverage < Test::Unit::TestCase
def test_method_coverage_for_alias
_C = DummyConstant.new("C")
_M = DummyConstant.new("M")
- code = <<-"end;"
+ code = <<~"end;"
module M
def foo
end
@@ -403,19 +403,19 @@ class TestCoverage < Test::Unit::TestCase
result = {
:methods => {
- [_C, :baz, 8] => 0,
- [_M, :foo, 2] => 0,
+ [_C, :baz, 8, 2, 9, 5] => 0,
+ [_M, :foo, 2, 2, 3, 5] => 0,
}
}
assert_coverage(code, { methods: true }, result)
result = {
:methods => {
- [_C, :baz, 8] => 12,
- [_M, :foo, 2] => 3,
+ [_C, :baz, 8, 2, 9, 5] => 12,
+ [_M, :foo, 2, 2, 3, 5] => 3,
}
}
- assert_coverage(code + <<-"end;", { methods: true }, result)
+ assert_coverage(code + <<~"end;", { methods: true }, result)
obj = C.new
1.times { obj.foo }
2.times { obj.bar }
@@ -427,7 +427,7 @@ class TestCoverage < Test::Unit::TestCase
def test_method_coverage_for_singleton_class
_singleton_Foo = DummyConstant.new("#<Class:Foo>")
_Foo = DummyConstant.new("Foo")
- code = <<-"end;"
+ code = <<~"end;"
class Foo
def foo
end
@@ -447,8 +447,8 @@ class TestCoverage < Test::Unit::TestCase
result = {
:methods => {
- [_singleton_Foo, :baz, 5] => 12,
- [_Foo, :foo, 2] => 3,
+ [_singleton_Foo, :baz, 5, 2, 6, 5] => 12,
+ [_Foo, :foo, 2, 2, 3, 5] => 3,
}
}
assert_coverage(code, { methods: true }, result)