use strict;
use warnings;
use File::Temp;
use Test::More 0.88;
require './t/';

#Disable warnings for awkard test file mechanism required by Windows
my(undef, $tempname) = do{ $^W=0; File::Temp::tempfile(OPEN=>0)};
END{ close(TMP); unlink $tempname or die "Could not unlink '$tempname': $!" }

#Print the heredoc in to temp file via redirection
my $q = q['];
$q = q["] if $^O =~ /MSWin32/;
my $blib = -e "blib" ? '-Mblib' : '';
system qq("$^X" $blib -MIO::Pager::Page -e $q require q[./t/]; print \$txt $q >$tempname);

open(TMP, $tempname) or die "Could not open tmpfile: $!\n";
my $slurp = do{ undef $/; <TMP> };

our $txt; require './t/';
ok($txt eq $slurp, 'Redirection (IO::Pager::Page)');