Skip to content

Commit

Permalink
Ignore invalid 3 colons in completion
Browse files Browse the repository at this point in the history
  • Loading branch information
aycabta committed Sep 10, 2021
1 parent 4781f67 commit 5e29e3e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/irb/completion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def self.retrieve_completion_data(input, bind: IRB.conf[:MAIN_CONTEXT].workspace
all_gvars.grep(Regexp.new(Regexp.quote(gvar)))
end

when /^([^."].*)(\.|::)([^.]*)$/
when /^([^.:"].*)(\.|::)([^.]*)$/
# variable.func or func.func
receiver = $1
sep = $2
Expand Down
5 changes: 5 additions & 0 deletions test/irb/test_completion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ def test_complete_symbol
assert_empty(IRB::InputCompletor.retrieve_completion_data(":irb_unknown_symbol_abcdefg", bind: binding))
end

def test_complete_invalid_three_colons
assert_empty(IRB::InputCompletor.retrieve_completion_data(":::A", bind: binding))
assert_empty(IRB::InputCompletor.retrieve_completion_data(":::", bind: binding))
end

def test_complete_symbol_failure
assert_nil(IRB::InputCompletor::PerfectMatchedProc.(":aiueo", bind: binding))
end
Expand Down

0 comments on commit 5e29e3e

Please sign in to comment.