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:18:40 +0000
committeryui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-22 13:18:40 +0000
commit755dd9f4618d79b375b79152b72234f004e55f78 (patch)
tree2dfaf5578a90179dacfd7293ccc2720cd8fb9205 /test/coverage/test_coverage.rb
parent47d939a7c0a85ac0919100eaed2df4bbf09c71d7 (diff)
Add column numbers to branch coverage
* compile.c (DECL_BRANCH_BASE, ADD_TRACE_BRANCH_COVERAGE): Add column to arguments. * compile.c (compile_if, compile_case, compile_when, compile_loop, iseq_compile_each0): Pass column numbers to macros. * ext/coverage/coverage.c (branch_coverage): Add column numbers to a return value. * test/coverage/test_coverage.rb: Follow-up these changes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/coverage/test_coverage.rb')
-rw-r--r--test/coverage/test_coverage.rb20
1 files changed, 10 insertions, 10 deletions
diff --git a/test/coverage/test_coverage.rb b/test/coverage/test_coverage.rb
index ac2c4c1..038e958 100644
--- a/test/coverage/test_coverage.rb
+++ b/test/coverage/test_coverage.rb
@@ -197,8 +197,8 @@ class TestCoverage < Test::Unit::TestCase
def test_branch_coverage_for_if_statement
result = {
:branches => {
- [:if , 0, 2] => {[:then, 1, 3]=>2, [:else, 2, 5]=>1},
- [:unless, 3, 8] => {[:else, 4, 11]=>2, [:then, 5, 9]=>1},
+ [: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},
}
}
assert_coverage(<<-"end;", { branches: true }, result)
@@ -225,8 +225,8 @@ class TestCoverage < Test::Unit::TestCase
def test_branch_coverage_for_while_statement
result = {
:branches => {
- [:while, 0, 2] => {[:body, 1, 3]=> 3},
- [:until, 2, 5] => {[:body, 3, 6]=>10},
+ [:while, 0, 2, 6] => {[:body, 1, 3, 8]=> 3},
+ [:until, 2, 5, 6] => {[:body, 3, 6, 8]=>10},
}
}
assert_coverage(<<-"end;", { branches: true }, result)
@@ -243,10 +243,10 @@ class TestCoverage < Test::Unit::TestCase
def test_branch_coverage_for_case_statement
result = {
:branches => {
- [:case, 0, 2] => {[:when, 1, 4]=>2, [:when, 2, 6]=>0, [:else, 3, 2]=>1},
- [:case, 4, 9] => {[:when, 5, 11]=>2, [:when, 6, 13]=>0, [:else, 7, 9]=>1},
- [:case, 8, 16] => {[:when, 9, 18]=>2, [:when, 10, 20]=>0, [:else, 11, 22]=>1},
- [:case, 12, 25] => {[:when, 13, 27]=>2, [:when, 14, 29]=>0, [:else, 15, 31]=>1},
+ [: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},
}
}
assert_coverage(<<-"end;", { branches: true }, result)
@@ -293,8 +293,8 @@ class TestCoverage < Test::Unit::TestCase
def test_branch_coverage_for_safe_method_invocation
result = {
:branches=>{
- [:"&.", 0, 3] => {[:then, 1, 3]=>1, [:else, 2, 3]=>0},
- [:"&.", 3, 4] => {[:then, 4, 4]=>0, [:else, 5, 4]=>1},
+ [:"&.", 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},
}
}
assert_coverage(<<-"end;", { branches: true }, result)