summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/thread.c b/thread.c
index a68651b2e1..e3efcd3946 100644
--- a/thread.c
+++ b/thread.c
@@ -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);
}