diff options
-rw-r--r-- | lib/irb/completion.rb | 2 | ||||
-rw-r--r-- | test/irb/test_completion.rb | 7 |
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 |