mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Refactor the internal data format for coverage measurement
To prepare new measuring targets: branch and method coverages. So far, iseq->coverage was an array of counts executed for line coverage. Now, it is a three-element array for each measuring target, whose first element is an array for line coverage. The second element is planned for branch coverage, and the third will be for method coverage. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c10baca4ae
commit
cd6df5fb3c
7 changed files with 79 additions and 26 deletions
|
@ -24,7 +24,7 @@ rb_coverage_start(VALUE klass)
|
|||
if (!RTEST(coverages)) {
|
||||
coverages = rb_hash_new();
|
||||
rb_obj_hide(coverages);
|
||||
rb_set_coverages(coverages);
|
||||
rb_set_coverages(coverages, COVERAGE_TARGET_LINES);
|
||||
}
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -35,9 +35,12 @@ coverage_peek_result_i(st_data_t key, st_data_t val, st_data_t h)
|
|||
VALUE path = (VALUE)key;
|
||||
VALUE coverage = (VALUE)val;
|
||||
VALUE coverages = (VALUE)h;
|
||||
coverage = rb_ary_dup(coverage);
|
||||
rb_ary_freeze(coverage);
|
||||
rb_hash_aset(coverages, path, coverage);
|
||||
VALUE lines = RARRAY_AREF(coverage, COVERAGE_INDEX_LINES);
|
||||
if (lines) {
|
||||
lines = rb_ary_dup(lines);
|
||||
rb_ary_freeze(lines);
|
||||
}
|
||||
rb_hash_aset(coverages, path, lines);
|
||||
return ST_CONTINUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue