summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2019-12-08 08:35:31 +0900
committeraycabta <aycabta@gmail.com>2019-12-08 08:35:31 +0900
commitc38bc172bee99ff71440a1ebb4c38e6d092e0807 (patch)
tree3bf9a17842e81decc8f1561df739e5039ec2c569
parent2eb674377371d276b9de5ce06a591419f00f7c42 (diff)
Fix encoding of completed list
-rw-r--r--test/readline/test_readline.rb29
1 files changed, 28 insertions, 1 deletions
diff --git a/test/readline/test_readline.rb b/test/readline/test_readline.rb
index 129adc7a7ab..3c1f74a0caa 100644
--- a/test/readline/test_readline.rb
+++ b/test/readline/test_readline.rb
@@ -586,7 +586,9 @@ module BasetestReadline
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
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)