ruby-changes:59109
From: aycabta <ko1@a...>
Date: Sun, 8 Dec 2019 08:10:50 +0900 (JST)
Subject: [ruby-changes:59109] c9b06d4a4e (master): Add test_simple_completion for Readline
https://git.ruby-lang.org/ruby.git/commit/?id=c9b06d4a4e From c9b06d4a4e52b6ae705ebb16cafe455671780770 Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Sun, 8 Dec 2019 08:01:27 +0900 Subject: Add test_simple_completion for Readline diff --git a/test/readline/test_readline.rb b/test/readline/test_readline.rb index e1c299c..129adc7 100644 --- a/test/readline/test_readline.rb +++ b/test/readline/test_readline.rb @@ -578,6 +578,25 @@ module BasetestReadline https://github.com/ruby/ruby/blob/trunk/test/readline/test_readline.rb#L578 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) -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/