summaryrefslogtreecommitdiff
path: root/t/lib/compress/oneshot.pl
diff options
context:
space:
mode:
Diffstat (limited to 't/lib/compress/oneshot.pl')
-rw-r--r--t/lib/compress/oneshot.pl34
1 files changed, 33 insertions, 1 deletions
diff --git a/t/lib/compress/oneshot.pl b/t/lib/compress/oneshot.pl
index 0646958d89..4f8bb83ac6 100644
--- a/t/lib/compress/oneshot.pl
+++ b/t/lib/compress/oneshot.pl
@@ -16,7 +16,7 @@ BEGIN {
$extra = 1
if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
- plan tests => 970 + $extra ;
+ plan tests => 986 + $extra ;
use_ok('IO::Uncompress::AnyUncompress', qw(anyuncompress $AnyUncompressError)) ;
@@ -42,6 +42,9 @@ sub run
my $Func = getTopFuncRef($bit);
my $TopType = getTopFuncName($bit);
+ #my $inverse = getInverse($bit);
+ #my $InverseFunc = getTopFuncRef($inverse);
+
title "Testing $TopType Error Cases";
my $a;
@@ -510,6 +513,7 @@ sub run
my $TopTypeInverse = getInverse($bit);
my $FuncInverse = getTopFuncRef($TopTypeInverse);
+ my $ErrorInverse = getErrorRef($TopTypeInverse);
my $lex = new LexFile(my $file1, my $file2) ;
@@ -606,6 +610,34 @@ sub run
my @headers = getHeaders($file3);
is @headers, $ms ? @input : 1, " Header count ok";
}
+
+ SKIP:
+ {
+ title "Truncated file";
+ skip '', 7
+ if $CompressClass =~ /lzop|lzf/i ;
+
+ my @in ;
+ push @in, "abcde" x 10;
+ push @in, "defgh" x 1000;
+ push @in, "12345" x 50000;
+
+ my $out;
+
+ for (@in) {
+ ok &$Func(\$_ , \$out, Append => 1 ), ' Compressed ok'
+ or diag $$Error;
+ }
+ #ok &$Func(\@in, \$out, MultiStream => 1 ), ' Compressed ok'
+ substr($out, -179) = '';
+
+ my $got;
+ my $status ;
+ ok $status = &$FuncInverse(\$out => \$got, MultiStream => 0), " Uncompressed stream 1 ok";
+ is $got, "abcde" x 10 ;
+ ok ! &$FuncInverse(\$out => \$got, MultiStream => 1), " Didn't uncompress";
+ is $$ErrorInverse, "unexpected end of file", " Got unexpected eof";
+ }
}
}