summaryrefslogtreecommitdiff
path: root/ext/coverage
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 /ext/coverage
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 'ext/coverage')
-rw-r--r--ext/coverage/coverage.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/ext/coverage/coverage.c b/ext/coverage/coverage.c
index c2ccd34..c4070fa 100644
--- a/ext/coverage/coverage.c
+++ b/ext/coverage/coverage.c
@@ -82,13 +82,15 @@ branch_coverage(VALUE branches)
VALUE branches = RARRAY_AREF(structure, i);
VALUE base_type = RARRAY_AREF(branches, 0);
VALUE base_lineno = RARRAY_AREF(branches, 1);
+ VALUE base_column = RARRAY_AREF(branches, 2);
VALUE children = rb_hash_new();
- rb_hash_aset(ret, rb_ary_new_from_args(3, base_type, LONG2FIX(id++), base_lineno), children);
- for (j = 2; j < RARRAY_LEN(branches); j += 3) {
+ rb_hash_aset(ret, rb_ary_new_from_args(4, base_type, LONG2FIX(id++), base_lineno, base_column), children);
+ for (j = 3; j < RARRAY_LEN(branches); j += 4) {
VALUE target_label = RARRAY_AREF(branches, j);
VALUE target_lineno = RARRAY_AREF(branches, j + 1);
- int idx = FIX2INT(RARRAY_AREF(branches, j + 2));
- rb_hash_aset(children, rb_ary_new_from_args(3, target_label, LONG2FIX(id++), target_lineno), RARRAY_AREF(counters, idx));
+ VALUE target_column = RARRAY_AREF(branches, j + 2);
+ int idx = FIX2INT(RARRAY_AREF(branches, j + 3));
+ rb_hash_aset(children, rb_ary_new_from_args(4, target_label, LONG2FIX(id++), target_lineno, target_column), RARRAY_AREF(counters, idx));
}
}