mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
This commit was manufactured by cvs2svn to create branch 'ruby_1_8'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
00f6107621
commit
29b2917e3b
2 changed files with 502 additions and 0 deletions
35
test/ruby/test_objectspace.rb
Normal file
35
test/ruby/test_objectspace.rb
Normal file
|
@ -0,0 +1,35 @@
|
|||
require 'test/unit'
|
||||
|
||||
class TestObjectSpace < Test::Unit::TestCase
|
||||
def self.deftest_id2ref(obj)
|
||||
/:(\d+)/ =~ caller[0]
|
||||
file = $`
|
||||
line = $1.to_i
|
||||
eval <<"End", binding, file, line
|
||||
define_method("test_id2ref_#{line}") {\
|
||||
o = ObjectSpace._id2ref(obj.object_id);\
|
||||
assert_equal(obj, o, "didn't round trip: #{obj.inspect}");\
|
||||
}
|
||||
End
|
||||
end
|
||||
|
||||
deftest_id2ref(-0x4000000000000001)
|
||||
deftest_id2ref(-0x4000000000000000)
|
||||
deftest_id2ref(-0x40000001)
|
||||
deftest_id2ref(-0x40000000)
|
||||
deftest_id2ref(-1)
|
||||
deftest_id2ref(0)
|
||||
deftest_id2ref(1)
|
||||
deftest_id2ref(0x3fffffff)
|
||||
deftest_id2ref(0x40000000)
|
||||
deftest_id2ref(0x3fffffffffffffff)
|
||||
deftest_id2ref(0x4000000000000000)
|
||||
deftest_id2ref(:a)
|
||||
deftest_id2ref(:abcdefghijilkjl)
|
||||
deftest_id2ref(:==)
|
||||
deftest_id2ref(Object.new)
|
||||
deftest_id2ref(self)
|
||||
deftest_id2ref(true)
|
||||
deftest_id2ref(false)
|
||||
deftest_id2ref(nil)
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue