summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTakashi Sakaguchi <takashi.sakaguchi@ummm.info>2025-12-26 12:37:46 +0900
committergit <svn-admin@ruby-lang.org>2025-12-26 03:38:16 +0000
commit594dd8bfd4c2b380dc7185d421d71b29c379356b (patch)
treeea032b53696b048918d91dc6bf11f6464879737c /test
parent9824724b2ffe583302e9318c6eff7a440478125f (diff)
[ruby/pp] Support private instance_variables_to_inspect
(https://github.com/ruby/pp/pull/70) * Support private instance_variables_to_inspect in pp Ruby supports calling instance_variables_to_inspect even when it is defined as a private method (ruby/ruby#13555). This change aligns pp with Ruby's behavior. https://github.com/ruby/pp/commit/8450e76db6
Diffstat (limited to 'test')
-rw-r--r--test/test_pp.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/test_pp.rb b/test/test_pp.rb
index 4a273e6edd..922ed371af 100644
--- a/test/test_pp.rb
+++ b/test/test_pp.rb
@@ -146,7 +146,9 @@ class PPInspectTest < Test::Unit::TestCase
def test_iv_hiding_via_ruby
a = Object.new
- def a.instance_variables_to_inspect() [:@b] end
+ a.singleton_class.class_eval do
+ private def instance_variables_to_inspect() [:@b] end
+ end
a.instance_eval { @a = "aaa"; @b = "bbb" }
assert_match(/\A#<Object:0x[\da-f]+ @b="bbb">\n\z/, PP.pp(a, ''.dup))
end