summaryrefslogtreecommitdiffstats
path: root/test/ext
diff options
context:
space:
mode:
Diffstat (limited to 'test/ext')
-rw-r--r--test/ext/capture_output.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/ext/capture_output.rb b/test/ext/capture_output.rb
new file mode 100644
index 0000000..6fef849
--- /dev/null
+++ b/test/ext/capture_output.rb
@@ -0,0 +1,23 @@
+module CaptureOutput
+ def before_setup
+ super
+ $stderr = @stderr = StringIO.new
+ $stdout = @stdout = StringIO.new
+ end
+ def after_teardown
+ super
+ $stderr = STDERR
+ $stdout = STDOUT
+ end
+ def error_output
+ @stderr.string
+ end
+ def standard_output
+ @stdout.string
+ end
+end
+class HCl::TestCase < MiniTest::Unit::TestCase
+ include CaptureOutput
+end
+
+