summaryrefslogtreecommitdiff
path: root/test/objspace/test_objspace.rb
diff options
context:
space:
mode:
authorlukeg <luke.gru@gmail.com>2023-04-03 14:46:43 -0400
committerAaron Patterson <tenderlove@ruby-lang.org>2023-05-18 09:17:24 -0700
commitd74b32db9d1e0234b17e4645d270394f7b657f85 (patch)
treeaefed90694340bc0413d1fbd17d6664155eb1866 /test/objspace/test_objspace.rb
parent0c3f699268a9b3d41b5023425a419c8b5cf00dbb (diff)
change to test/objectspace, don't rely on Object's shape not being "too complex"
Diffstat (limited to 'test/objspace/test_objspace.rb')
-rw-r--r--test/objspace/test_objspace.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/objspace/test_objspace.rb b/test/objspace/test_objspace.rb
index 172bd6fff6..4d8adba5e8 100644
--- a/test/objspace/test_objspace.rb
+++ b/test/objspace/test_objspace.rb
@@ -287,13 +287,17 @@ class TestObjSpace < Test::Unit::TestCase
JSON.parse(info) if defined?(JSON)
end
+ class TooComplex; end
+
if defined?(RubyVM::Shape)
def test_dump_too_complex_shape
RubyVM::Shape::SHAPE_MAX_VARIATIONS.times do
- Object.new.instance_variable_set(:"@a#{_1}", 1)
+ TooComplex.new.instance_variable_set(:"@a#{_1}", 1)
end
- tc = Object.new
+ tc = TooComplex.new
+ info = ObjectSpace.dump(tc)
+ assert_not_match(/"too_complex_shape"/, info)
tc.instance_variable_set(:@new_ivar, 1)
info = ObjectSpace.dump(tc)
assert_match(/"too_complex_shape":true/, info)