diff options
| author | (no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-03-04 06:28:55 +0000 |
|---|---|---|
| committer | (no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-03-04 06:28:55 +0000 |
| commit | c35142f56d2f197c7249d3a1cf865b6bda66180d (patch) | |
| tree | e8c0c36df99e1df89347a2a075360d8bdbc714eb /test/ruby | |
| parent | dbb31b249bc4f3a43fd527b74f78d9743174c0e9 (diff) | |
| download | ruby-c35142f56d2f197c7249d3a1cf865b6bda66180d.tar.gz ruby-c35142f56d2f197c7249d3a1cf865b6bda66180d.tar.xz ruby-c35142f56d2f197c7249d3a1cf865b6bda66180d.zip | |
This commit was manufactured by cvs2svn to create branch 'ruby_1_8'.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@10023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_objectspace.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/ruby/test_objectspace.rb b/test/ruby/test_objectspace.rb new file mode 100644 index 000000000..dab94688e --- /dev/null +++ b/test/ruby/test_objectspace.rb @@ -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 |
