summaryrefslogtreecommitdiff
path: root/test/coverage/test_coverage.rb
diff options
context:
space:
mode:
authoryui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-22 13:34:24 +0000
committeryui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-22 13:34:24 +0000
commitde482ab1436ea124237ee5c4cde492fe2ee311fb (patch)
tree6f67f68c897ddc46f543d718911ac40997ac7748 /test/coverage/test_coverage.rb
parent755dd9f4618d79b375b79152b72234f004e55f78 (diff)
test/coverage/test_coverage.rb: Use `<<~` to ease to calculate column of target codes
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/coverage/test_coverage.rb')
-rw-r--r--test/coverage/test_coverage.rb28
1 files changed, 14 insertions, 14 deletions
diff --git a/test/coverage/test_coverage.rb b/test/coverage/test_coverage.rb
index 038e958..3a12ad1 100644
--- a/test/coverage/test_coverage.rb
+++ b/test/coverage/test_coverage.rb
@@ -197,11 +197,11 @@ class TestCoverage < Test::Unit::TestCase
def test_branch_coverage_for_if_statement
result = {
:branches => {
- [:if , 0, 2, 8] => {[:then, 1, 3, 10]=>2, [:else, 2, 5, 10]=>1},
- [:unless, 3, 8, 8] => {[:else, 4, 11, 10]=>2, [:then, 5, 9, 10]=>1},
+ [:if , 0, 2, 2] => {[:then, 1, 3, 4]=>2, [:else, 2, 5, 4]=>1},
+ [:unless, 3, 8, 2] => {[:else, 4, 11, 4]=>2, [:then, 5, 9, 4]=>1},
}
}
- assert_coverage(<<-"end;", { branches: true }, result)
+ assert_coverage(<<~"end;", { branches: true }, result)
def foo(x)
if x == 0
0
@@ -225,11 +225,11 @@ class TestCoverage < Test::Unit::TestCase
def test_branch_coverage_for_while_statement
result = {
:branches => {
- [:while, 0, 2, 6] => {[:body, 1, 3, 8]=> 3},
- [:until, 2, 5, 6] => {[:body, 3, 6, 8]=>10},
+ [:while, 0, 2, 0] => {[:body, 1, 3, 2]=> 3},
+ [:until, 2, 5, 0] => {[:body, 3, 6, 2]=>10},
}
}
- assert_coverage(<<-"end;", { branches: true }, result)
+ assert_coverage(<<~"end;", { branches: true }, result)
x = 3
while x > 0
x -= 1
@@ -243,13 +243,13 @@ class TestCoverage < Test::Unit::TestCase
def test_branch_coverage_for_case_statement
result = {
:branches => {
- [:case, 0, 2, 8] => {[:when, 1, 4, 10]=>2, [:when, 2, 6, 10]=>0, [:else, 3, 2, 8]=>1},
- [:case, 4, 9, 8] => {[:when, 5, 11, 10]=>2, [:when, 6, 13, 10]=>0, [:else, 7, 9, 8]=>1},
- [:case, 8, 16, 8] => {[:when, 9, 18, 10]=>2, [:when, 10, 20, 10]=>0, [:else, 11, 22, 10]=>1},
- [:case, 12, 25, 8] => {[:when, 13, 27, 10]=>2, [:when, 14, 29, 10]=>0, [:else, 15, 31, 10]=>1},
+ [:case, 0, 2, 2] => {[:when, 1, 4, 4]=>2, [:when, 2, 6, 4]=>0, [:else, 3, 2, 2]=>1},
+ [:case, 4, 9, 2] => {[:when, 5, 11, 4]=>2, [:when, 6, 13, 4]=>0, [:else, 7, 9, 2]=>1},
+ [:case, 8, 16, 2] => {[:when, 9, 18, 4]=>2, [:when, 10, 20, 4]=>0, [:else, 11, 22, 4]=>1},
+ [:case, 12, 25, 2] => {[:when, 13, 27, 4]=>2, [:when, 14, 29, 4]=>0, [:else, 15, 31, 4]=>1},
}
}
- assert_coverage(<<-"end;", { branches: true }, result)
+ assert_coverage(<<~"end;", { branches: true }, result)
def foo(x)
case x
when 0
@@ -293,11 +293,11 @@ class TestCoverage < Test::Unit::TestCase
def test_branch_coverage_for_safe_method_invocation
result = {
:branches=>{
- [:"&.", 0, 3, 6] => {[:then, 1, 3, 6]=>1, [:else, 2, 3, 6]=>0},
- [:"&.", 3, 4, 6] => {[:then, 4, 4, 6]=>0, [:else, 5, 4, 6]=>1},
+ [:"&.", 0, 3, 0] => {[:then, 1, 3, 0]=>1, [:else, 2, 3, 0]=>0},
+ [:"&.", 3, 4, 0] => {[:then, 4, 4, 0]=>0, [:else, 5, 4, 0]=>1},
}
}
- assert_coverage(<<-"end;", { branches: true }, result)
+ assert_coverage(<<~"end;", { branches: true }, result)
a = 10
b = nil
a&.abs