Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of github.com:sergot/IO-Capture-Simple

  • Loading branch information...
commit 675936e7208069bcb70177843d5b20821089a4e2 2 parents 263fbf7 + 595464d
@sergot authored
Showing with 26 additions and 0 deletions.
  1. +16 −0 lib/Test/IO/Capture.pm
  2. +10 −0 t/test-io-capture/01-basic.t
View
16 lib/Test/IO/Capture.pm
@@ -0,0 +1,16 @@
+use Test;
+use IO::Capture::Simple;
+
+module Test::IO::Capture;
+
+sub prints-stdout-ok (Callable $code, $expected as Str, $reason = '')
+is export {
+ my $out = capture_stdout $code;
+ is $out, $expected, $reason;
+}
+
+sub prints-stderr-ok (Callable $code, $expected as Str, $reason = '')
+is export {
+ my $out = capture_stderr $code;
+ is $out, $expected, $reason;
+}
View
10 t/test-io-capture/01-basic.t
@@ -0,0 +1,10 @@
+use Test::IO::Capture;
+use Test;
+
+plan 3;
+
+prints-stdout-ok { say 'zebra!' }, "zebra!\n", 'prints-stdout-ok';
+
+prints-stderr-ok { note 'giraffe!' }, "giraffe!\n", 'prints-stderr-ok';
+
+pass 'if this works, then stdout is back to normal';
Please sign in to comment.
Something went wrong with that request. Please try again.