зеркало из https://github.com/github/ruby.git
[ruby/irb] Use symbol.inspect instead of ":"+symbol.id2name to avoid
completion candidates including newline characters (https://github.com/ruby/irb/pull/539) https://github.com/ruby/irb/commit/aaf0c46645
This commit is contained in:
Родитель
27b07776c9
Коммит
5d91be7c1f
|
@ -218,7 +218,7 @@ module IRB
|
|||
else
|
||||
sym = $1
|
||||
candidates = Symbol.all_symbols.collect do |s|
|
||||
":" + s.id2name.encode(Encoding.default_external)
|
||||
s.inspect
|
||||
rescue EncodingError
|
||||
# ignore
|
||||
end
|
||||
|
|
|
@ -289,12 +289,14 @@ module TestIRB
|
|||
end
|
||||
|
||||
def test_complete_symbol
|
||||
%w"UTF-16LE UTF-7".each do |enc|
|
||||
symbols = %w"UTF-16LE UTF-7".map do |enc|
|
||||
"K".force_encoding(enc).to_sym
|
||||
rescue
|
||||
end
|
||||
_ = :aiueo
|
||||
assert_include(IRB::InputCompletor.retrieve_completion_data(":a", bind: binding), ":aiueo")
|
||||
symbols += [:aiueo, :"aiu eo"]
|
||||
candidates = IRB::InputCompletor.retrieve_completion_data(":a", bind: binding)
|
||||
assert_include(candidates, ":aiueo")
|
||||
assert_not_include(candidates, ":aiu eo")
|
||||
assert_empty(IRB::InputCompletor.retrieve_completion_data(":irb_unknown_symbol_abcdefg", bind: binding))
|
||||
# Do not complete empty symbol for performance reason
|
||||
assert_empty(IRB::InputCompletor.retrieve_completion_data(":", bind: binding))
|
||||
|
|
Загрузка…
Ссылка в новой задаче