diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-06 14:29:17 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-06 14:29:17 +0000 |
commit | 4225b29df96182f259289ed32a7ce40128b9a835 (patch) | |
tree | 5e5a17a195b10cfa7e0db26034fb3f68b40da4cf /thread.c | |
parent | 6a79276eddaafb5d80252b173c535e63f9d5c620 (diff) | |
download | bundler-4225b29df96182f259289ed32a7ce40128b9a835.tar.gz |
* ext/coverage/coverage.c: Fully reset coverage to not persist global state.
It was returning old file coverages as empty arrays to the user.
[ruby-core:74596] [Bug #12220]
* ext/coverage/coverage.c (rb_coverages): remove unused static state.
* thread.c: Moved and renamed coverage_clear_result_i to reset_coverage_i.
* test/coverage/test_coverage.rb: improve precision of tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r-- | thread.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -4800,9 +4800,20 @@ rb_set_coverages(VALUE coverages) rb_add_event_hook(update_coverage, RUBY_EVENT_COVERAGE, Qnil); } +/* Make coverage arrays empty so old covered files are no longer tracked. */ +static int +reset_coverage_i(st_data_t key, st_data_t val, st_data_t dummy) +{ + VALUE coverage = (VALUE)val; + rb_ary_clear(coverage); + return ST_CONTINUE; +} + void rb_reset_coverages(void) { + VALUE coverages = rb_get_coverages(); + st_foreach(rb_hash_tbl_raw(coverages), reset_coverage_i, 0); GET_VM()->coverages = Qfalse; rb_remove_event_hook(update_coverage); } |