mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix encoding of completed list
This commit is contained in:
parent
2eb6743773
commit
c38bc172be
1 changed files with 28 additions and 1 deletions
|
@ -586,7 +586,9 @@ module BasetestReadline
|
||||||
Readline.input = r
|
Readline.input = r
|
||||||
Readline.output = null
|
Readline.output = null
|
||||||
Readline.completion_proc = ->(text) do
|
Readline.completion_proc = ->(text) do
|
||||||
['abcde', 'abc12']
|
['abcde', 'abc12'].map { |i|
|
||||||
|
i.encode(get_default_internal_encoding)
|
||||||
|
}
|
||||||
end
|
end
|
||||||
w.write("a\t\n")
|
w.write("a\t\n")
|
||||||
w.flush
|
w.flush
|
||||||
|
@ -597,6 +599,31 @@ module BasetestReadline
|
||||||
assert_equal('abc', line)
|
assert_equal('abc', line)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_completion_with_completion_append_character
|
||||||
|
skip "Reline doesn't still implement it" if defined?(Reline) and Readline == Reline
|
||||||
|
line = nil
|
||||||
|
|
||||||
|
append_character = Readline.completion_append_character
|
||||||
|
open(IO::NULL, 'w') do |null|
|
||||||
|
IO.pipe do |r, w|
|
||||||
|
Readline.input = r
|
||||||
|
Readline.output = null
|
||||||
|
Readline.completion_append_character = '!'
|
||||||
|
Readline.completion_proc = ->(text) do
|
||||||
|
['abcde']
|
||||||
|
end
|
||||||
|
w.write("a\t\n")
|
||||||
|
w.flush
|
||||||
|
line = Readline.readline('> ', false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_equal('abcde!', line)
|
||||||
|
ensure
|
||||||
|
return if defined?(Reline) and Readline == Reline
|
||||||
|
Readline.completion_append_character = append_character
|
||||||
|
end
|
||||||
|
|
||||||
def test_completion_quote_character_completing_unquoted_argument
|
def test_completion_quote_character_completing_unquoted_argument
|
||||||
return unless Readline.respond_to?(:completion_quote_character)
|
return unless Readline.respond_to?(:completion_quote_character)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue