* test/readline/test_readline.rb (TestReadline::replace_stdio):

merged the patch of [ruby-dev:25232] instead of [ruby-dev:25223].
  (merged from ruby_1_8 branch)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shugo 2005-09-22 08:33:05 +00:00
parent 941af27490
commit 759410a8c9
2 changed files with 24 additions and 14 deletions

View File

@ -1,3 +1,9 @@
Thu Sep 22 17:31:48 2005 Shugo Maeda <shugo@ruby-lang.org>
* test/readline/test_readline.rb (TestReadline::replace_stdio):
merged the patch of [ruby-dev:25232] instead of [ruby-dev:25223].
(merged from ruby_1_8 branch)
Wed Sep 21 23:30:44 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/mkmf.rb (configuration): generalized nmake dependent code.

View File

@ -62,20 +62,24 @@ class TestReadline < Test::Unit::TestCase
private
def replace_stdio(stdin_path, stdout_path)
orig_stdin = STDIN.dup
orig_stdout = STDOUT.dup
STDIN.reopen(stdin_path, "r")
STDOUT.reopen(stdout_path, "w")
begin
Readline.input = STDIN
Readline.output = STDOUT
yield
ensure
STDIN.reopen(orig_stdin)
STDOUT.reopen(orig_stdout)
orig_stdin.close
orig_stdout.close
end
open(stdin_path, "r"){|stdin|
open(stdout_path, "w"){|stdout|
orig_stdin = STDIN.dup
orig_stdout = STDOUT.dup
STDIN.reopen(stdin)
STDOUT.reopen(stdout)
begin
Readline.input = STDIN
Readline.output = STDOUT
yield
ensure
STDIN.reopen(orig_stdin)
STDOUT.reopen(orig_stdout)
orig_stdin.close
orig_stdout.close
end
}
}
end
end