1BEGIN { 2 if ($ENV{PERL_CORE}) { 3 chdir 't' if -d 't'; 4 @INC = ("../lib", "lib/compress"); 5 } 6} 7 8use lib qw(t t/compress); 9 10use strict; 11use warnings; 12use bytes; 13 14use Test::More ; 15use CompTestUtils; 16 17BEGIN { 18 # use Test::NoWarnings, if available 19 my $extra = 0 ; 20 $extra = 1 21 if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 }; 22 23 plan tests => 15 + $extra ; 24 25 use_ok('IO::Uncompress::AnyUncompress', qw($AnyUncompressError)) ; 26 27} 28 29{ 30 31 my $string = <<EOM; 32This is not compressed data 33EOM 34 35 my $buffer = $string ; 36 37 for my $file (0, 1) 38 { 39 title "AnyUncompress with Non-compressed data (File $file)" ; 40 41 my $lex = new LexFile my $output; 42 my $input ; 43 44 if ($file) { 45 writeFile($output, $buffer); 46 $input = $output; 47 } 48 else { 49 $input = \$buffer; 50 } 51 52 53 my $unc ; 54 my $keep = $buffer ; 55 $unc = new IO::Uncompress::AnyUncompress $input, -Transparent => 0 ; 56 ok ! $unc," no AnyUncompress object when -Transparent => 0" ; 57 is $buffer, $keep ; 58 59 $buffer = $keep ; 60 $unc = new IO::Uncompress::AnyUncompress \$buffer, -Transparent => 1 ; 61 ok $unc, " AnyUncompress object when -Transparent => 1" ; 62 63 my $uncomp ; 64 ok $unc->read($uncomp) > 0 ; 65 ok $unc->eof() ; 66 #ok $unc->type eq $Type; 67 68 is $uncomp, $string ; 69 } 70} 71 721; 73