4 @INC = ("../lib", "lib/compress");
8 use lib qw(t t/compress);
21 my $lex = new LexFile my $outfile;
23 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut tempus odio id
24 dolor. Camelus perlus. Larrius in lumen numen. Dolor en quiquum filia
25 est. Quintus cenum parat.
28 writeWithGzip($outfile, $content)
32 readWithGzip($outfile, $got)
37 diag "Uncompressed content is wrong";
48 my $lex = new LexFile my $outfile;
50 my $comp = "$GZIP -dc" ;
52 if ( system("$comp $file >$outfile") == 0 )
54 $_[0] = readFile($outfile);
58 diag "'$comp' failed: $?";
71 my $options = shift || '';
73 my $lex = new LexFile my $infile;
74 writeFile($infile, $content);
77 my $comp = "$GZIP -c $options $infile >$file" ;
80 if system($comp) == 0 ;
82 diag "'$comp' failed: $?";
88 # Check external gzip is available
89 my $name = $^O =~ /mswin/i ? 'gzip.exe' : 'gzip';
90 my $split = $^O =~ /mswin/i ? ";" : ":";
92 for my $dir (reverse split $split, $ENV{PATH})
98 plan(skip_all => "Cannot find $name")
101 plan(skip_all => "$name doesn't work as expected")
102 if ! ExternalGzipWorks();
105 # use Test::NoWarnings, if available
108 if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
110 plan tests => 7 + $extra ;
112 use_ok('IO::Compress::Gzip', ':all') ;
113 use_ok('IO::Uncompress::Gunzip', ':all') ;
119 title "Test interop with $GZIP" ;
123 my $lex = new LexFile $file, $file1;
125 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut tempus odio id
126 dolor. Camelus perlus. Larrius in lumen numen. Dolor en quiquum filia
127 est. Quintus cenum parat.
131 ok writeWithGzip($file, $content), "writeWithGzip ok";
133 gunzip $file => \$got ;
134 is $got, $content, "got content";
137 gzip \$content => $file1;
139 ok readWithGzip($file1, $got), "readWithGzip ok";
140 is $got, $content, "got content";