From 15d7b0bfa57321e3988ba893e3bca90605d0d0ff Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Tue, 3 Jun 2025 15:51:26 +0900 Subject: [PATCH 1/2] Alias value to take in old Ruby --- test/test_ractor_compatibility.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/test_ractor_compatibility.rb b/test/test_ractor_compatibility.rb index 3166d0b..dfc9dc7 100644 --- a/test/test_ractor_compatibility.rb +++ b/test/test_ractor_compatibility.rb @@ -5,6 +5,10 @@ class RactorCompatibilityTest < Test::Unit::TestCase def test_class_name_suggestion_works_in_ractor assert_ractor(<<~CODE, require_relative: "helper") + class Ractor + alias value take + end unless Ractor.method_defined? :value # compat with Ruby 3.4 and olders + class ::Book; end include DidYouMean::TestHelper error = Ractor.new { @@ -22,6 +26,10 @@ class ::Book; end def test_key_name_suggestion_works_in_ractor assert_ractor(<<~CODE, require_relative: "helper") + class Ractor + alias value take + end unless Ractor.method_defined? :value # compat with Ruby 3.4 and olders + include DidYouMean::TestHelper error = Ractor.new { begin @@ -41,6 +49,10 @@ def test_key_name_suggestion_works_in_ractor def test_method_name_suggestion_works_in_ractor assert_ractor(<<~CODE, require_relative: "helper") + class Ractor + alias value take + end unless Ractor.method_defined? :value # compat with Ruby 3.4 and olders + include DidYouMean::TestHelper error = Ractor.new { begin @@ -59,6 +71,10 @@ def test_method_name_suggestion_works_in_ractor if defined?(::NoMatchingPatternKeyError) def test_pattern_key_name_suggestion_works_in_ractor assert_ractor(<<~CODE, require_relative: "helper") + class Ractor + alias value take + end unless Ractor.method_defined? :value # compat with Ruby 3.4 and olders + include DidYouMean::TestHelper error = Ractor.new { begin @@ -81,6 +97,10 @@ def test_pattern_key_name_suggestion_works_in_ractor def test_can_raise_other_name_error_in_ractor assert_ractor(<<~CODE, require_relative: "helper") + class Ractor + alias value take + end unless Ractor.method_defined? :value # compat with Ruby 3.4 and olders + class FirstNameError < NameError; end include DidYouMean::TestHelper error = Ractor.new { @@ -98,6 +118,10 @@ class FirstNameError < NameError; end def test_variable_name_suggestion_works_in_ractor assert_ractor(<<~CODE, require_relative: "helper") + class Ractor + alias value take + end unless Ractor.method_defined? :value # compat with Ruby 3.4 and olders + include DidYouMean::TestHelper error = Ractor.new { in_ractor = in_ractor = 1 From a7a438ae27dbb2f7e1577e939c38b6851011c74d Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Tue, 3 Jun 2025 16:09:52 +0900 Subject: [PATCH 2/2] Omit some tests with JRuby --- test/spell_checking/test_method_name_check.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/spell_checking/test_method_name_check.rb b/test/spell_checking/test_method_name_check.rb index 4daaf7c..2ae5fa7 100644 --- a/test/spell_checking/test_method_name_check.rb +++ b/test/spell_checking/test_method_name_check.rb @@ -98,6 +98,8 @@ def nil.empty? end def test_does_not_append_suggestions_twice + omit "This test is not working with JRuby" if RUBY_ENGINE == "jruby" + error = assert_raise NoMethodError do begin @user.firstname @@ -110,6 +112,8 @@ def test_does_not_append_suggestions_twice end def test_does_not_append_suggestions_three_times + omit "This test is not working with JRuby" if RUBY_ENGINE == "jruby" + error = assert_raise NoMethodError do begin @user.raise_no_method_error