summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-03-05 02:31:57 -0600
committerJesse Luehrs <doy@tozt.net>2012-03-05 02:31:57 -0600
commit7aa8236bc5b4cc795b6b329c6fb4cb50c21898c2 (patch)
treeb77aa79ae737aeb335bbbb6b97016d7eb5122c7d
parentaf3e6d8e163d6df3e74d371bef2aafb3ca43a2d2 (diff)
downloadterm-filter-7aa8236bc5b4cc795b6b329c6fb4cb50c21898c2.tar.gz
term-filter-7aa8236bc5b4cc795b6b329c6fb4cb50c21898c2.zip
test the non-terminal error
-rw-r--r--t/requires-tty.t23
1 files changed, 23 insertions, 0 deletions
diff --git a/t/requires-tty.t b/t/requires-tty.t
new file mode 100644
index 0000000..e574f67
--- /dev/null
+++ b/t/requires-tty.t
@@ -0,0 +1,23 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+use Test::Fatal;
+
+use Term::Filter;
+
+my ($input, $output);
+open my $infh, '<', \$input or die "Couldn't open: $!";
+open my $outfh, '<', \$output or die "Couldn't open: $!";
+like(
+ exception { Term::Filter->new(input => $infh) },
+ qr/Term::Filter requires input and output filehandles to be attached to a terminal/,
+ "requires a terminal"
+);
+like(
+ exception { Term::Filter->new(output => $outfh) },
+ qr/Term::Filter requires input and output filehandles to be attached to a terminal/,
+ "requires a terminal"
+);
+
+done_testing;