summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/lib/Test/More/Catch.pm30
1 files changed, 30 insertions, 0 deletions
diff --git a/t/lib/Test/More/Catch.pm b/t/lib/Test/More/Catch.pm
new file mode 100644
index 0000000000..aed94682d4
--- /dev/null
+++ b/t/lib/Test/More/Catch.pm
@@ -0,0 +1,30 @@
+# For testing Test::More;
+package Catch;
+
+my $out = tie *Test::Simple::TESTOUT, 'Catch';
+tie *Test::More::TESTOUT, 'Catch', $out;
+my $err = tie *Test::More::TESTERR, 'Catch';
+tie *Test::Simple::TESTERR, 'Catch', $err;
+
+# We have to use them to shut up a "used only once" warning.
+() = (*Test::More::TESTOUT, *Test::More::TESTERR);
+
+sub caught { return $out, $err }
+
+
+sub PRINT {
+ my $self = shift;
+ $$self .= join '', @_;
+}
+
+sub TIEHANDLE {
+ my($class, $self) = @_;
+ my $foo = '';
+ $self = $self || \$foo;
+ return bless $self, $class;
+}
+sub READ {}
+sub READLINE {}
+sub GETC {}
+
+1;