From cd94bcdc46fc5d8f6bc0da23223c75335677d253 Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Thu, 30 Mar 2023 17:17:17 +0100 Subject: [ruby/irb] Don't check RUBY_ENGINE when deciding whether to accept kargs Ruby implementations like JRuby and TruffleRuby already indicate their compatibility target with RUBY_VERSION. We don't need to exclude them from accepting keyword arguments as long as they target 2.7+. https://github.com/ruby/irb/commit/bf20faa4e6 Co-authored-by: Kevin Menard --- lib/irb/cmd/nop.rb | 2 +- lib/irb/extend-command.rb | 2 +- test/irb/test_cmd.rb | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/irb/cmd/nop.rb b/lib/irb/cmd/nop.rb index 34facc7578..2e112d1705 100644 --- a/lib/irb/cmd/nop.rb +++ b/lib/irb/cmd/nop.rb @@ -30,7 +30,7 @@ module IRB end end - if RUBY_ENGINE == "ruby" && RUBY_VERSION >= "2.7.0" + if RUBY_VERSION >= "2.7.0" def self.execute(conf, *opts, **kwargs, &block) command = new(conf) command.execute(*opts, **kwargs, &block) diff --git a/lib/irb/extend-command.rb b/lib/irb/extend-command.rb index e68b79daa7..4018eb13a6 100644 --- a/lib/irb/extend-command.rb +++ b/lib/irb/extend-command.rb @@ -256,7 +256,7 @@ module IRB # :nodoc: end if load_file - kwargs = ", **kwargs" if RUBY_ENGINE == "ruby" && RUBY_VERSION >= "2.7.0" + kwargs = ", **kwargs" if RUBY_VERSION >= "2.7.0" line = __LINE__; eval %[ def #{cmd_name}(*opts#{kwargs}, &b) Kernel.require_relative "#{load_file}" diff --git a/test/irb/test_cmd.rb b/test/irb/test_cmd.rb index 8af7562505..ef864fb5c9 100644 --- a/test/irb/test_cmd.rb +++ b/test/irb/test_cmd.rb @@ -733,7 +733,6 @@ module TestIRB end def test_ls_grep - pend if RUBY_ENGINE == 'truffleruby' out, err = execute_lines("ls 42\n") assert_empty err assert_match(/times/, out) @@ -752,7 +751,6 @@ module TestIRB end def test_ls_grep_empty - pend if RUBY_ENGINE == 'truffleruby' out, err = execute_lines("ls\n") assert_empty err assert_match(/whereami/, out) -- cgit v1.2.3