From 4d2062b493dabfffd594fab7a0c4afeacfb0e402 Mon Sep 17 00:00:00 2001 From: ksss Date: Thu, 15 Oct 2026 11:30:12 +0900 Subject: [PATCH] Skip Class#initialize test on Ruby 4.1+ Class#initialize was removed and Class.allocate now raises TypeError in ruby/ruby@0adee861cb586a011fc4c77eb00758cb3f2cfd93. Co-Authored-By: Claude Opus 5.5 --- test/stdlib/Class_test.rb | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/test/stdlib/Class_test.rb b/test/stdlib/Class_test.rb index ad36130a29..757c966e1e 100644 --- a/test/stdlib/Class_test.rb +++ b/test/stdlib/Class_test.rb @@ -36,17 +36,21 @@ def initialize(*a, **k, &b) = nil end def test_initialize - assert_send_type "() -> void", - Class.allocate, :initialize + # Class#initialize was removed in Ruby 4.1 and Class.allocate raises TypeError + # https://github.com/ruby/ruby/commit/0adee861cb586a011fc4c77eb00758cb3f2cfd93 + if_ruby(..."4.1") do + assert_send_type "() -> void", + Class.allocate, :initialize - assert_send_type "() { (Class) [self: Class] -> void } -> void", - Class.allocate, :initialize do end + assert_send_type "() { (Class) [self: Class] -> void } -> void", + Class.allocate, :initialize do end - assert_send_type "(Class) -> void", - Class.allocate, :initialize, String + assert_send_type "(Class) -> void", + Class.allocate, :initialize, String - assert_send_type "(Class) { (Class) [self: Class] -> void } -> void", - Class.allocate, :initialize, String do end + assert_send_type "(Class) { (Class) [self: Class] -> void } -> void", + Class.allocate, :initialize, String do end + end end def test_superclass