test/readline/test_readline.rb: suppress bell

* test/readline/test_readline.rb (replace_stdio, with_pipe): suppress bell.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-04-27 01:41:02 +00:00
Родитель c746b6fa42
Коммит 664a13b732
1 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -372,13 +372,16 @@ class TestReadline < Test::Unit::TestCase
open(stdout_path, "w"){|stdout|
orig_stdin = STDIN.dup
orig_stdout = STDOUT.dup
orig_stderr = STDERR.dup
STDIN.reopen(stdin)
STDOUT.reopen(stdout)
STDERR.reopen(stdout)
begin
Readline.input = STDIN
Readline.output = STDOUT
yield
ensure
STDERR.reopen(orig_stderr)
STDIN.reopen(orig_stdin)
STDOUT.reopen(orig_stdout)
orig_stdin.close
@ -398,13 +401,20 @@ class TestReadline < Test::Unit::TestCase
end
def with_pipe
stderr = nil
IO.pipe do |r, w|
yield(r, w)
Readline.input = r
Readline.output = w.reopen(IO::NULL)
stderr = STDERR.dup
STDERR.reopen(w)
Readline.readline
end
ensure
if stderr
STDERR.reopen(stderr)
stderr.close
end
Readline.input = STDIN
Readline.output = STDOUT
end