mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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:
parent
c746b6fa42
commit
664a13b732
1 changed files with 10 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue