mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Add test_simple_completion for Readline
This commit is contained in:
parent
be13b897ea
commit
c9b06d4a4e
1 changed files with 19 additions and 0 deletions
|
@ -578,6 +578,25 @@ module BasetestReadline
|
|||
Readline.completer_word_break_characters = saved_completer_word_break_characters
|
||||
end
|
||||
|
||||
def test_simple_completion
|
||||
line = nil
|
||||
|
||||
open(IO::NULL, 'w') do |null|
|
||||
IO.pipe do |r, w|
|
||||
Readline.input = r
|
||||
Readline.output = null
|
||||
Readline.completion_proc = ->(text) do
|
||||
['abcde', 'abc12']
|
||||
end
|
||||
w.write("a\t\n")
|
||||
w.flush
|
||||
line = Readline.readline('> ', false)
|
||||
end
|
||||
end
|
||||
|
||||
assert_equal('abc', line)
|
||||
end
|
||||
|
||||
def test_completion_quote_character_completing_unquoted_argument
|
||||
return unless Readline.respond_to?(:completion_quote_character)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue