ruby-changes:59111
From: aycabta <ko1@a...>
Date: Sun, 8 Dec 2019 08:35:54 +0900 (JST)
Subject: [ruby-changes:59111] c38bc172be (master): Fix encoding of completed list
https://git.ruby-lang.org/ruby.git/commit/?id=c38bc172be From c38bc172bee99ff71440a1ebb4c38e6d092e0807 Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Sun, 8 Dec 2019 08:35:31 +0900 Subject: Fix encoding of completed list diff --git a/test/readline/test_readline.rb b/test/readline/test_readline.rb index 129adc7..3c1f74a 100644 --- a/test/readline/test_readline.rb +++ b/test/readline/test_readline.rb @@ -586,7 +586,9 @@ module BasetestReadline https://github.com/ruby/ruby/blob/trunk/test/readline/test_readline.rb#L586 Readline.input = r Readline.output = null Readline.completion_proc = ->(text) do - ['abcde', 'abc12'] + ['abcde', 'abc12'].map { |i| + i.encode(get_default_internal_encoding) + } end w.write("a\t\n") w.flush @@ -597,6 +599,31 @@ module BasetestReadline https://github.com/ruby/ruby/blob/trunk/test/readline/test_readline.rb#L599 assert_equal('abc', line) 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 return unless Readline.respond_to?(:completion_quote_character) -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/