From f42535fa38ff487382db32158908635e1a356d5c Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Sat, 20 Dec 2025 16:33:21 -0500 Subject: Change test to define ivars in initialize method Defining ivars in initialize method guarantees the object to be embedded. --- test/ruby/test_object.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'test/ruby') diff --git a/test/ruby/test_object.rb b/test/ruby/test_object.rb index cccd7359e1..41585ba150 100644 --- a/test/ruby/test_object.rb +++ b/test/ruby/test_object.rb @@ -359,11 +359,13 @@ class TestObject < Test::Unit::TestCase require "objspace" c = Class.new do - def a = @a + attr_reader :a, :b, :c - def b = @b - - def c = @c + def initialize + @a = nil + @b = nil + @c = nil + end end o1 = c.new -- cgit v1.2.3