summaryrefslogtreecommitdiffstats
path: root/t/requires-tty.t
diff options
context:
space:
mode:
Diffstat (limited to 't/requires-tty.t')
-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;