"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "t/02_methods.t" between
Archive-Tar-2.32.tar.gz and Archive-Tar-2.34.tar.gz

About: Archive-Tar is a Perl module for creation and in-memory manipulation of tar files.

02_methods.t  (Archive-Tar-2.32):02_methods.t  (Archive-Tar-2.34)
skipping to change at line 100 skipping to change at line 100
$Archive::Tar::DEBUG = $Archive::Tar::DEBUG = 1 if $ARGV[1]; $Archive::Tar::DEBUG = $Archive::Tar::DEBUG = 1 if $ARGV[1];
### tests for binary and x/x files ### tests for binary and x/x files
my $TARBIN = $Class->new; my $TARBIN = $Class->new;
my $TARX = $Class->new; my $TARX = $Class->new;
### paths to a .tar and .tgz file to use for tests ### paths to a .tar and .tgz file to use for tests
my $TAR_FILE = File::Spec->catfile( @ROOT, 'bar.tar' ); my $TAR_FILE = File::Spec->catfile( @ROOT, 'bar.tar' );
my $TGZ_FILE = File::Spec->catfile( @ROOT, 'foo.tgz' ); my $TGZ_FILE = File::Spec->catfile( @ROOT, 'foo.tgz' );
my $TBZ_FILE = File::Spec->catfile( @ROOT, 'foo.tbz' ); my $TBZ_FILE = File::Spec->catfile( @ROOT, 'foo.tbz' );
my $TXZ_FILE = File::Spec->catfile( @ROOT, 'foo.txz' );
my $OUT_TAR_FILE = File::Spec->catfile( @ROOT, 'out.tar' ); my $OUT_TAR_FILE = File::Spec->catfile( @ROOT, 'out.tar' );
my $OUT_TGZ_FILE = File::Spec->catfile( @ROOT, 'out.tgz' ); my $OUT_TGZ_FILE = File::Spec->catfile( @ROOT, 'out.tgz' );
my $OUT_TBZ_FILE = File::Spec->catfile( @ROOT, 'out.tbz' ); my $OUT_TBZ_FILE = File::Spec->catfile( @ROOT, 'out.tbz' );
my $OUT_TXZ_FILE = File::Spec->catfile( @ROOT, 'out.txz' );
my $COMPRESS_FILE = 'copy'; my $COMPRESS_FILE = 'copy';
$^O eq 'VMS' and $COMPRESS_FILE .= '.'; $^O eq 'VMS' and $COMPRESS_FILE .= '.';
copy( File::Basename::basename($0), $COMPRESS_FILE ); copy( File::Basename::basename($0), $COMPRESS_FILE );
chmod 0644, $COMPRESS_FILE; chmod 0644, $COMPRESS_FILE;
### done setting up environment ### ### done setting up environment ###
### check for zlib/bzip2 support ### check for zlib/bzip2/xz support
{ for my $meth ( qw[has_zlib_support has_bzip2_support] ) { { for my $meth ( qw[has_zlib_support has_bzip2_support has_xz_support] ) {
can_ok( $Class, $meth ); can_ok( $Class, $meth );
} }
} }
### tar error tests ### tar error tests
{ my $tar = $Class->new; { my $tar = $Class->new;
ok( $tar, "Object created" ); ok( $tar, "Object created" );
isa_ok( $tar, $Class ); isa_ok( $tar, $Class );
skipping to change at line 166 skipping to change at line 168
my $rv = $tar->contains_file( $$ ); my $rv = $tar->contains_file( $$ );
ok( !$rv, "Does not contain file '$$'" ); ok( !$rv, "Does not contain file '$$'" );
is( $warnings, '', " No warnings issued during lookup" ); is( $warnings, '', " No warnings issued during lookup" );
} }
} }
### read tests ### ### read tests ###
{ my @to_try = ($TAR_FILE); { my @to_try = ($TAR_FILE);
push @to_try, $TGZ_FILE if $Class->has_zlib_support; push @to_try, $TGZ_FILE if $Class->has_zlib_support;
push @to_try, $TBZ_FILE if $Class->has_bzip2_support; push @to_try, $TBZ_FILE if $Class->has_bzip2_support;
push @to_try, $TXZ_FILE if $Class->has_xz_support;
for my $type( @to_try ) { for my $type( @to_try ) {
### normal tar + gz compressed file ### normal tar + gz compressed file
my $tar = $Class->new; my $tar = $Class->new;
### check we got the object ### check we got the object
ok( $tar, "Object created" ); ok( $tar, "Object created" );
isa_ok( $tar, $Class ); isa_ok( $tar, $Class );
skipping to change at line 459 skipping to change at line 462
ok( $Class->extract_archive( $out ), ok( $Class->extract_archive( $out ),
" Extracted file using 'extract_archiv e'"); " Extracted file using 'extract_archiv e'");
rm( $out ) unless $NO_UNLINK; rm( $out ) unless $NO_UNLINK;
} }
} }
## write tgz tests ## write tgz tests
{ my @out; { my @out;
push @out, [ $OUT_TGZ_FILE => 1 ] if $Class->has_zlib_su pport; push @out, [ $OUT_TGZ_FILE => 1 ] if $Class->has_zlib_su pport;
push @out, [ $OUT_TBZ_FILE => COMPRESS_BZIP ] if $Class->has_bzip2_s upport; push @out, [ $OUT_TBZ_FILE => COMPRESS_BZIP ] if $Class->has_bzip2_s upport;
push @out, [ $OUT_TXZ_FILE => COMPRESS_XZ ] if $Class->has_xz_supp ort;
for my $entry ( @out ) { for my $entry ( @out ) {
my( $out, $compression ) = @$entry; my( $out, $compression ) = @$entry;
{ ### write() { ### write()
ok($obj->write($out, $compression), ok($obj->write($out, $compression),
" Writing compressed file '$out' using 'write'" ); " Writing compressed file '$out' using 'write'" );
check_compressed_file( $out ); check_compressed_file( $out );
skipping to change at line 777 skipping to change at line 781
binmode $fh; binmode $fh;
local $/; local $/;
return <$fh>; return <$fh>;
} }
sub slurp_compressed_file { sub slurp_compressed_file {
my $file = shift; my $file = shift;
my $fh; my $fh;
### xz
if( $file =~ /.txz$/ ) {
require IO::Uncompress::UnXz;
$fh = IO::Uncompress::UnXz->new( $file )
or warn( "Error opening '$file' with IO::Uncompress::UnXz" ), return
### bzip2 ### bzip2
if( $file =~ /.tbz$/ ) { } elsif( $file =~ /.tbz$/ ) {
require IO::Uncompress::Bunzip2; require IO::Uncompress::Bunzip2;
$fh = IO::Uncompress::Bunzip2->new( $file ) $fh = IO::Uncompress::Bunzip2->new( $file )
or warn( "Error opening '$file' with IO::Uncompress::Bunzip2" ), ret urn or warn( "Error opening '$file' with IO::Uncompress::Bunzip2" ), ret urn
### gzip ### gzip
} else { } else {
require IO::Zlib; require IO::Zlib;
$fh = new IO::Zlib; $fh = new IO::Zlib;
$fh->open( $file, READ_ONLY->(1) ) $fh->open( $file, READ_ONLY->(1) )
or warn( "Error opening '$file' with IO::Zlib" ), return or warn( "Error opening '$file' with IO::Zlib" ), return
 End of changes. 7 change blocks. 
3 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)