summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2025-12-20 16:33:21 -0500
committerPeter Zhu <peter@peterzhu.ca>2025-12-20 18:14:48 -0500
commitf42535fa38ff487382db32158908635e1a356d5c (patch)
treeb635f37e1df23811ffa6a1ee9d6601873557e8c6 /test/ruby
parent580872785181303f26f715b5acc611d0ec087256 (diff)
Change test to define ivars in initialize method
Defining ivars in initialize method guarantees the object to be embedded.
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_object.rb10
1 files changed, 6 insertions, 4 deletions
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