From 7aa8236bc5b4cc795b6b329c6fb4cb50c21898c2 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 5 Mar 2012 02:31:57 -0600 Subject: test the non-terminal error --- t/requires-tty.t | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 t/requires-tty.t 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; -- cgit v1.2.3