mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/irb] Ignore any encoding errors while symbol completion
daa65cded1
This commit is contained in:
parent
e6118c8108
commit
ede95f541b
2 changed files with 5 additions and 1 deletions
|
@ -192,7 +192,7 @@ module IRB
|
||||||
sym = $1
|
sym = $1
|
||||||
candidates = Symbol.all_symbols.collect do |s|
|
candidates = Symbol.all_symbols.collect do |s|
|
||||||
":" + s.id2name.encode(Encoding.default_external)
|
":" + s.id2name.encode(Encoding.default_external)
|
||||||
rescue Encoding::UndefinedConversionError
|
rescue EncodingError
|
||||||
# ignore
|
# ignore
|
||||||
rescue Encoding::InvalidByteSequenceError => e
|
rescue Encoding::InvalidByteSequenceError => e
|
||||||
raise "Invalid byte sequence #{s.id2name.bytes.inspect} #{e.inspect}"
|
raise "Invalid byte sequence #{s.id2name.bytes.inspect} #{e.inspect}"
|
||||||
|
|
|
@ -27,6 +27,10 @@ module TestIRB
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_complete_symbol
|
def test_complete_symbol
|
||||||
|
%w"UTF-16LE UTF-7".each do |enc|
|
||||||
|
"K".force_encoding(enc).to_sym
|
||||||
|
rescue
|
||||||
|
end
|
||||||
_ = :aiueo
|
_ = :aiueo
|
||||||
assert_include(IRB::InputCompletor.retrieve_completion_data(":a", bind: binding), ":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))
|
assert_empty(IRB::InputCompletor.retrieve_completion_data(":irb_unknown_symbol_abcdefg", bind: binding))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue