ruby-changes:68417
From: Ka=C3=ADque <ko1@a...>
Date: Wed, 13 Oct 2021 06:34:00 +0900 (JST)
Subject: [ruby-changes:68417] 5c646ca0a0 (master): [ruby/irb] Ignore parenthesis during completion
https://git.ruby-lang.org/ruby.git/commit/?id=5c646ca0a0 From 5c646ca0a09c5249b20cf5645e27ee75fe4dff04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ka=C3=ADque=20Kandy=20Koga?= <kaiquekandykoga@g...> Date: Sun, 10 Oct 2021 16:30:42 -0300 Subject: [ruby/irb] Ignore parenthesis during completion Rename method https://github.com/ruby/irb/commit/619aecb412 --- lib/irb/completion.rb | 2 +- test/irb/test_completion.rb | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb index a8a73cce80..9121174a50 100644 --- a/lib/irb/completion.rb +++ b/lib/irb/completion.rb @@ -197,7 +197,7 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/completion.rb#L197 end candidates.grep(/^#{Regexp.quote(sym)}/) - when /^::([A-Z][^:\.\(]*)$/ + when /^::([A-Z][^:\.\(\)]*)$/ # Absolute Constant or class methods receiver = $1 candidates = Object.constants.collect{|m| m.to_s} diff --git a/test/irb/test_completion.rb b/test/irb/test_completion.rb index 819a958887..3aa99d74d3 100644 --- a/test/irb/test_completion.rb +++ b/test/irb/test_completion.rb @@ -41,6 +41,13 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_completion.rb#L41 assert_empty(IRB::InputCompletor.retrieve_completion_data(":::", bind: binding)) end + def test_complete_absolute_constants_with_special_characters + assert_empty(IRB::InputCompletor.retrieve_completion_data("::A:", bind: binding)) + assert_empty(IRB::InputCompletor.retrieve_completion_data("::A.", bind: binding)) + assert_empty(IRB::InputCompletor.retrieve_completion_data("::A(", bind: binding)) + assert_empty(IRB::InputCompletor.retrieve_completion_data("::A)", bind: binding)) + end + def test_complete_symbol_failure assert_nil(IRB::InputCompletor::PerfectMatchedProc.(":aiueo", bind: binding)) end -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/