mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
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
This commit is contained in:
parent
47d939a7c0
commit
755dd9f461
3 changed files with 41 additions and 32 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue