diff --git a/test/test_error_highlight.rb b/test/test_error_highlight.rb index ec39b1c..5f664de 100644 --- a/test/test_error_highlight.rb +++ b/test/test_error_highlight.rb @@ -1085,10 +1085,11 @@ def test_args_CALL_1 end end + OF_NIL_INTO_INTEGER = RUBY_VERSION < "4.1." ? "from nil to integer" : "of nil into Integer" def test_args_CALL_2 v = [] assert_error_message(TypeError, <<~END) do -no implicit conversion from nil to integer (TypeError) +no implicit conversion #{OF_NIL_INTO_INTEGER} (TypeError) v[nil] ^^^ @@ -1115,7 +1116,7 @@ def test_args_ATTRASGN_1 def test_args_ATTRASGN_2 v = [] assert_error_message(TypeError, <<~END) do -no implicit conversion from nil to integer (TypeError) +no implicit conversion #{OF_NIL_INTO_INTEGER} (TypeError) v [nil] = 1 ^^^^^^^^ @@ -1177,7 +1178,7 @@ def test_args_OP_ASGN1_aref_1 v = [] assert_error_message(TypeError, <<~END) do -no implicit conversion from nil to integer (TypeError) +no implicit conversion #{OF_NIL_INTO_INTEGER} (TypeError) v [nil] += 42 ^^^^^^^^^^