summaryrefslogtreecommitdiff
path: root/ext/coverage
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-03 12:55:12 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-03 12:55:12 +0000
commitf08581c7b6cfeb3c843257385e9c2611cd473806 (patch)
tree9572fae0dd214bcdb10eaeec2b6643107b84986c /ext/coverage
parent16519f1ff9bfd74474f5c4177795feaba7765d0c (diff)
* ext/coverage/coverage.c, ext/coverage/extconf.rb: eliminate
COVERAGE__ and introduce coverage.so instead. How to measure coverage: (1) require "coverage.so", (2) require or load Ruby source file, and (3) Coverage.result will return the same hash as COVERAGE__. [ruby-dev:35324] * thread.c (rb_enable_coverages): start coverage measurement by using rb_add_event_hook. * thread.c (rb_get_coverages): returns current results of coverage measurement. * include/ruby/intern.h: add prototype for above two functions. * vm_core.h, vm.c: add field of coverages to rb_vm_t. * insns.def (trace): remove special handling for COVERAGE__. * iseq.c (prepare_iseq_build): switch COVERAGE__ to rb_get_coverages(). * parse.y (coverage): ditto. * thread.c (clear_coverage): ditto. * lib/coverage.rb: use coverage.so instead of COVERAGE__. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/coverage')
-rw-r--r--ext/coverage/coverage.c11
-rw-r--r--ext/coverage/extconf.rb2
2 files changed, 13 insertions, 0 deletions
diff --git a/ext/coverage/coverage.c b/ext/coverage/coverage.c
new file mode 100644
index 0000000..a56a408
--- /dev/null
+++ b/ext/coverage/coverage.c
@@ -0,0 +1,11 @@
+#include "ruby.h"
+
+VALUE rb_mCoverage;
+
+void
+Init_coverage(void)
+{
+ rb_enable_coverages();
+ rb_mCoverage = rb_define_module("Coverage");
+ rb_define_module_function(rb_mCoverage, "result", rb_get_coverages, 0);
+}
diff --git a/ext/coverage/extconf.rb b/ext/coverage/extconf.rb
new file mode 100644
index 0000000..3ebced5
--- /dev/null
+++ b/ext/coverage/extconf.rb
@@ -0,0 +1,2 @@
+require 'mkmf'
+create_makefile('coverage')