mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/ruby/test_gc.rb: add tests to achieve over 90% test coverage of
gc.c. * test/ruby/test_objectspace.rb: ditto. * test/ruby/test_marshal.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5e9b9ff9cb
commit
00aae60f73
4 changed files with 59 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
require 'test/unit'
|
||||
require_relative 'envutil'
|
||||
|
||||
class TestObjectSpace < Test::Unit::TestCase
|
||||
def self.deftest_id2ref(obj)
|
||||
|
@ -53,4 +54,18 @@ End
|
|||
assert_same(h0, h)
|
||||
assert_equal(0, h0[:T_FOO])
|
||||
end
|
||||
|
||||
def test_finalizer
|
||||
EnvUtil.rubyexec("-e", <<-END) do |w, r, e|
|
||||
a = []
|
||||
ObjectSpace.define_finalizer(a) { p :ok }
|
||||
b = a.dup
|
||||
ObjectSpace.define_finalizer(a) { p :ok }
|
||||
END
|
||||
assert_equal("", e.read)
|
||||
assert_equal(":ok\n:ok\n:ok\n:ok\n", r.read)
|
||||
|
||||
assert_raise(ArgumentError) { ObjectSpace.define_finalizer([], Object.new) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue