From 9c6ae17a6606a01f57ef6ad302c90e488f188cba Mon Sep 17 00:00:00 2001 From: naruse Date: Tue, 19 Jun 2012 04:15:37 +0000 Subject: [PATCH] Add test for [Bug #6262] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/readline/test_readline.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/readline/test_readline.rb b/test/readline/test_readline.rb index 0600084ff1..4a7954dfc6 100644 --- a/test/readline/test_readline.rb +++ b/test/readline/test_readline.rb @@ -414,6 +414,28 @@ class TestReadline < Test::Unit::TestCase Readline::HISTORY.clear end if !/EditLine/n.match(Readline::VERSION) + def test_input_metachar_multibyte + bug6602 = '[ruby-core:45683]' + Readline::HISTORY << "\u3042\u3093" + Readline::HISTORY << "\u3044\u3093" + Readline::HISTORY << "\u3046\u3093" + open(IO::NULL, 'w') do |null| + IO.pipe do |r, w| + Readline.input = r + Readline.output = null + w << "\cr\u3093\n\n" + w << "\cr\u3042\u3093" + w.reopen(IO::NULL) + assert_equal("\u3046\u3093", Readline.readline("", true), bug6602) + assert_equal("\u3042\u3093", Readline.readline("", true), bug6602) + assert_equal(nil, Readline.readline("", true), bug6602) + end + end + ensure + with_pipe {|r, w| w.write("\C-a\C-k\n")} # clear line_buffer + Readline::HISTORY.clear + end if !/EditLine/n.match(Readline::VERSION) + private def replace_stdio(stdin_path, stdout_path)