summaryrefslogtreecommitdiffstats
path: root/test/readline
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-22 08:33:05 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-22 08:33:05 +0000
commit84d371fdab00a84c1111b6a5724d5ed5dbba9348 (patch)
treed91dd5279b455dbe0fb732f34118c5e9cec7fd16 /test/readline
parentbfa3f0d9ebb63926ce73127c6a9899017e92718d (diff)
downloadruby-84d371fdab00a84c1111b6a5724d5ed5dbba9348.tar.gz
ruby-84d371fdab00a84c1111b6a5724d5ed5dbba9348.tar.xz
ruby-84d371fdab00a84c1111b6a5724d5ed5dbba9348.zip
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@9270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/readline')
-rw-r--r--test/readline/test_readline.rb32
1 files changed, 18 insertions, 14 deletions
diff --git a/test/readline/test_readline.rb b/test/readline/test_readline.rb
index b6f2d2c8b..73a496a4f 100644
--- a/test/readline/test_readline.rb
+++ b/test/readline/test_readline.rb
@@ -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