From 10979b8f5cebf4500bc71f85277c3249512cd01c Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Tue, 6 Jan 2026 16:44:50 +0900 Subject: [PATCH] Ruby 4.1 changed `source_location` type --- test/stdlib/Method_test.rb | 6 ++++-- test/stdlib/Proc_test.rb | 6 ++++-- test/stdlib/UnboundMethod_test.rb | 10 ++++++---- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/test/stdlib/Method_test.rb b/test/stdlib/Method_test.rb index d38280f1d..05da1a947 100644 --- a/test/stdlib/Method_test.rb +++ b/test/stdlib/Method_test.rb @@ -154,8 +154,10 @@ def test_receiver end def test_source_location - assert_send_type '() -> [String, Integer]', - METHOD, :source_location + if_ruby(..."4.1") do + assert_send_type '() -> [String, Integer]', + METHOD, :source_location + end assert_send_type '() -> nil', method(:__id__), :source_location end diff --git a/test/stdlib/Proc_test.rb b/test/stdlib/Proc_test.rb index 2ee9fc6ac..481c60535 100644 --- a/test/stdlib/Proc_test.rb +++ b/test/stdlib/Proc_test.rb @@ -139,8 +139,10 @@ def test_parameters end def test_source_location - assert_send_type '() -> [String, Integer]', - proc{}, :source_location + if_ruby(..."4.1") do + assert_send_type '() -> [String, Integer]', + proc{}, :source_location + end assert_send_type '() -> nil', Proc.new(&Kernel.method(:print)), :source_location end diff --git a/test/stdlib/UnboundMethod_test.rb b/test/stdlib/UnboundMethod_test.rb index 8f9f65f13..604c8960f 100644 --- a/test/stdlib/UnboundMethod_test.rb +++ b/test/stdlib/UnboundMethod_test.rb @@ -89,10 +89,12 @@ def test_parameters end def test_source_location - assert_send_type '() -> [String, Integer]?', - UMETH, :source_location - assert_send_type '() -> [String, Integer]?', - ParamMeths.instance_method(:leading_optional), :source_location + if_ruby(..."4.1") do + assert_send_type '() -> [String, Integer]?', + UMETH, :source_location + assert_send_type '() -> [String, Integer]?', + ParamMeths.instance_method(:leading_optional), :source_location + end end def test_super_method