summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaĆ­que Kandy Koga <[email protected]>2021-10-10 16:30:42 -0300
committergit <[email protected]>2021-10-13 06:33:48 +0900
commit5c646ca0a09c5249b20cf5645e27ee75fe4dff04 (patch)
tree8e8d59158edba9f2715d7f0730fffa0cfa70f2fa
parent38d255d023373a665ce0d2622ed6e25462653a2a (diff)
[ruby/irb] Ignore parenthesis during completion
Rename method https://github.com/ruby/irb/commit/619aecb412
-rw-r--r--lib/irb/completion.rb2
-rw-r--r--test/irb/test_completion.rb7
2 files changed, 8 insertions, 1 deletions
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
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
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