From ebd9f29b38e0ac81937b8c83c886d115c6b1dcf7 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Sat, 14 Jun 2025 13:34:47 +0900 Subject: [PATCH] The method #initialize_copy should be private, no direct call Fixed test/t/array.rb and test/t/string.rb in standard tests. And mrbgems/mruby-struct/test/struct.rb as well. --- mrbgems/mruby-struct/test/struct.rb | 2 +- test/t/array.rb | 2 +- test/t/string.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mrbgems/mruby-struct/test/struct.rb b/mrbgems/mruby-struct/test/struct.rb index 0c6efacd1..d10dc866c 100644 --- a/mrbgems/mruby-struct/test/struct.rb +++ b/mrbgems/mruby-struct/test/struct.rb @@ -169,7 +169,7 @@ assert("Struct#initialize_copy requires struct to be the same type") do Struct.__send__(:remove_const,:Test) Struct.new("Test", :a, :b) assert_raise(TypeError) do - a.initialize_copy(Struct::Test.new("a", "b")) + a.__send__(:initialize_copy, Struct::Test.new("a", "b")) end ensure Struct.__send__(:remove_const,:Test) diff --git a/test/t/array.rb b/test/t/array.rb index 9737365a7..52ae7ccb0 100644 --- a/test/t/array.rb +++ b/test/t/array.rb @@ -208,7 +208,7 @@ end assert('Array#initialize_copy', '15.2.12.5.16') do a = [1,2,3] - b = [].initialize_copy(a) + b = [].__send__(:initialize_copy, a) assert_equal([1,2,3], b) end diff --git a/test/t/string.rb b/test/t/string.rb index 70f81f12a..d74132d86 100644 --- a/test/t/string.rb +++ b/test/t/string.rb @@ -494,7 +494,7 @@ end assert('String#initialize_copy', '15.2.10.5.24') do a = '' - a.initialize_copy('abc') + a.__send__(:initialize_copy, 'abc') assert_equal 'abc', a end