diff options
| author | Peter Zhu <peter@peterzhu.ca> | 2025-05-09 12:07:04 -0400 |
|---|---|---|
| committer | Peter Zhu <peter@peterzhu.ca> | 2025-05-09 12:43:08 -0400 |
| commit | 011982ef837150044d9f18acc49a7b70e39eaf76 (patch) | |
| tree | d51f33a59253989065d4141ba811cf4a7916372f /test/ruby | |
| parent | 102063f964f16373e448baa968772b6aa79c067c (diff) | |
Fix warnings in tests for ObjectSpace._id2ref
There's a lot of warnings when running test_objectspace.rb because of
ObjectSpace._id2ref. For example:
test_objectspace.rb:19: warning: ObjectSpace._id2ref is deprecated
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/13293
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_objectspace.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/test/ruby/test_objectspace.rb b/test/ruby/test_objectspace.rb index d161d8079a..ef85edc5ee 100644 --- a/test/ruby/test_objectspace.rb +++ b/test/ruby/test_objectspace.rb @@ -8,7 +8,7 @@ class TestObjectSpace < Test::Unit::TestCase line = $1.to_i code = <<"End" define_method("test_id2ref_#{line}") {\ - o = ObjectSpace._id2ref(obj.object_id);\ + o = EnvUtil.suppress_warning { ObjectSpace._id2ref(obj.object_id) } assert_same(obj, o, "didn't round trip: \#{obj.inspect}");\ } End @@ -57,12 +57,12 @@ End def test_id2ref_invalid_argument msg = /no implicit conversion/ - assert_raise_with_message(TypeError, msg) {ObjectSpace._id2ref(nil)} - assert_raise_with_message(TypeError, msg) {ObjectSpace._id2ref(false)} - assert_raise_with_message(TypeError, msg) {ObjectSpace._id2ref(true)} - assert_raise_with_message(TypeError, msg) {ObjectSpace._id2ref(:a)} - assert_raise_with_message(TypeError, msg) {ObjectSpace._id2ref("0")} - assert_raise_with_message(TypeError, msg) {ObjectSpace._id2ref(Object.new)} + assert_raise_with_message(TypeError, msg) { EnvUtil.suppress_warning { ObjectSpace._id2ref(nil) } } + assert_raise_with_message(TypeError, msg) { EnvUtil.suppress_warning { ObjectSpace._id2ref(false) } } + assert_raise_with_message(TypeError, msg) { EnvUtil.suppress_warning { ObjectSpace._id2ref(true) } } + assert_raise_with_message(TypeError, msg) { EnvUtil.suppress_warning { ObjectSpace._id2ref(:a) } } + assert_raise_with_message(TypeError, msg) { EnvUtil.suppress_warning { ObjectSpace._id2ref("0") } } + assert_raise_with_message(TypeError, msg) { EnvUtil.suppress_warning { ObjectSpace._id2ref(Object.new) } } end def test_id2ref_invalid_symbol_id @@ -70,7 +70,7 @@ End # 8 bits of the object is equal to RUBY_SYMBOL_FLAG, so we need to make # sure that the bottom 8 bits remain unchanged. msg = /is not a symbol id value/ - assert_raise_with_message(RangeError, msg) { ObjectSpace._id2ref(:a.object_id + 256) } + assert_raise_with_message(RangeError, msg) { EnvUtil.suppress_warning { ObjectSpace._id2ref(:a.object_id + 256) } } end def test_count_objects |
