summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2019-12-08 08:01:27 +0900
committeraycabta <aycabta@gmail.com>2019-12-08 08:01:27 +0900
commitc9b06d4a4e52b6ae705ebb16cafe455671780770 (patch)
treebcf78ee1b47458c96ea9becbbd920acbe10e5d3b
parentbe13b897ead62debd6d2e7696e5d28a8e8781620 (diff)
Add test_simple_completion for Readline
-rw-r--r--test/readline/test_readline.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/readline/test_readline.rb b/test/readline/test_readline.rb
index e1c299c3c20..129adc7a7ab 100644
--- a/test/readline/test_readline.rb
+++ b/test/readline/test_readline.rb
@@ -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)