From cc1063092b366a0a8449528ab6bf67a72f5ce027 Mon Sep 17 00:00:00 2001 From: tmm1 Date: Sun, 8 Dec 2013 04:05:59 +0000 Subject: vm.c: add RubyVM.stat for accessing cache serials * vm.c (ruby_vm_stat): add RubyVM.stat() for access to internal cache counters. this methods behaves like GC.stat, accepting an optional hash or symbol argument. [Bug #9190] [ruby-core:58750] * test/ruby/test_rubyvm.rb: test for new method git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_rubyvm.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 test/ruby/test_rubyvm.rb (limited to 'test') diff --git a/test/ruby/test_rubyvm.rb b/test/ruby/test_rubyvm.rb new file mode 100644 index 0000000000..c63ee9f2c4 --- /dev/null +++ b/test/ruby/test_rubyvm.rb @@ -0,0 +1,16 @@ +require 'test/unit' + +class TestRubyVM < Test::Unit::TestCase + def test_stat + assert_kind_of Hash, RubyVM.stat + assert_kind_of Fixnum, RubyVM.stat[:method_serial] + + RubyVM.stat(stat = {}) + assert_not_empty stat + assert_equal stat[:method_serial], RubyVM.stat(:method_serial) + end + + def test_stat_unknown + assert_raise(ArgumentError){ RubyVM.stat(:unknown) } + end +end -- cgit v1.2.3