summaryrefslogtreecommitdiffstats
path: root/test/rake/capture_stdout.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-02 19:07:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-02 19:07:55 +0000
commit8da109fa1ec17fb4096470fe97135f41cdd3345b (patch)
treec5a08c8c9abae9b7f0514f680f56553a7a03656a /test/rake/capture_stdout.rb
parentb43ab1d7f1a8bc1a6fbca4d193c37fb0c6d28281 (diff)
downloadruby-8da109fa1ec17fb4096470fe97135f41cdd3345b.tar.gz
ruby-8da109fa1ec17fb4096470fe97135f41cdd3345b.tar.xz
ruby-8da109fa1ec17fb4096470fe97135f41cdd3345b.zip
* lib/rake: updated to rake code to rake-0.8.7 source code base.
* lib/rake/loaders/makefile.rb (Rake::MakefileLoader#process_line): respace dependencies too. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rake/capture_stdout.rb')
-rw-r--r--test/rake/capture_stdout.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/rake/capture_stdout.rb b/test/rake/capture_stdout.rb
new file mode 100644
index 000000000..f54ec42f6
--- /dev/null
+++ b/test/rake/capture_stdout.rb
@@ -0,0 +1,24 @@
+require 'stringio'
+
+# Mix-in for capturing standard output.
+module CaptureStdout
+ def capture_stdout
+ s = StringIO.new
+ oldstdout = $stdout
+ $stdout = s
+ yield
+ s.string
+ ensure
+ $stdout = oldstdout
+ end
+
+ def capture_stderr
+ s = StringIO.new
+ oldstderr = $stderr
+ $stderr = s
+ yield
+ s.string
+ ensure
+ $stderr = oldstderr
+ end
+end