[ruby/irb] Fixed string escaping omissions
(https://github.com/ruby/irb/pull/599) I received a `RegexpError` when I typed `::Array[`. ::Array[/Users/mi/ghq/github.com/ruby/irb/lib/irb/completion.rb:236:in `retrieve_completion_data': premature end of char-class: /^Array[/ (RegexpError)
This commit is contained in:
parent
135a5eb716
commit
76ee4edb97
@ -233,7 +233,7 @@ module IRB
|
|||||||
if doc_namespace
|
if doc_namespace
|
||||||
candidates.find { |i| i == receiver }
|
candidates.find { |i| i == receiver }
|
||||||
else
|
else
|
||||||
candidates.grep(/^#{receiver}/).collect{|e| "::" + e}
|
candidates.grep(/^#{Regexp.quote(receiver)}/).collect{|e| "::" + e}
|
||||||
end
|
end
|
||||||
|
|
||||||
when /^([A-Z].*)::([^:.]*)$/
|
when /^([A-Z].*)::([^:.]*)$/
|
||||||
|
@ -310,6 +310,7 @@ module TestIRB
|
|||||||
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))
|
||||||
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
|
end
|
||||||
|
|
||||||
def test_complete_reserved_words
|
def test_complete_reserved_words
|
||||||
|
Loading…
x
Reference in New Issue
Block a user