зеркало из https://github.com/github/ruby.git
[ruby/irb] Ignore any encoding errors while symbol completion
https://github.com/ruby/irb/commit/daa65cded1
This commit is contained in:
Родитель
e6118c8108
Коммит
ede95f541b
|
@ -192,7 +192,7 @@ module IRB
|
|||
sym = $1
|
||||
candidates = Symbol.all_symbols.collect do |s|
|
||||
":" + s.id2name.encode(Encoding.default_external)
|
||||
rescue Encoding::UndefinedConversionError
|
||||
rescue EncodingError
|
||||
# ignore
|
||||
rescue Encoding::InvalidByteSequenceError => e
|
||||
raise "Invalid byte sequence #{s.id2name.bytes.inspect} #{e.inspect}"
|
||||
|
|
|
@ -27,6 +27,10 @@ module TestIRB
|
|||
end
|
||||
|
||||
def test_complete_symbol
|
||||
%w"UTF-16LE UTF-7".each do |enc|
|
||||
"K".force_encoding(enc).to_sym
|
||||
rescue
|
||||
end
|
||||
_ = :aiueo
|
||||
assert_include(IRB::InputCompletor.retrieve_completion_data(":a", bind: binding), ":aiueo")
|
||||
assert_empty(IRB::InputCompletor.retrieve_completion_data(":irb_unknown_symbol_abcdefg", bind: binding))
|
||||
|
|
Загрузка…
Ссылка в новой задаче