1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Add test for [Bug #6262]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2012-06-19 04:15:37 +00:00
parent 2418f9cc55
commit 9c6ae17a66

View file

@ -414,6 +414,28 @@ class TestReadline < Test::Unit::TestCase
Readline::HISTORY.clear Readline::HISTORY.clear
end if !/EditLine/n.match(Readline::VERSION) 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 private
def replace_stdio(stdin_path, stdout_path) def replace_stdio(stdin_path, stdout_path)