1 BEGIN { chdir 't' if -d 't' }
8 use File::Temp qw( tempfile );
12 # tarballs available for testing
14 [qw( src short bar.tar )],
15 [qw( src long bar.tar )],
16 [qw( src linktest linktest_with_dir.tar )],
19 [qw( src short foo.tgz )],
20 [qw( src long foo.tgz )]
21 if Archive::Tar->has_zlib_support;
23 [qw( src short foo.tbz )],
24 [qw( src long foo.tbz )]
25 if Archive::Tar->has_bzip2_support;
27 @archives = map File::Spec->catfile(@$_), @archives;
29 plan tests => scalar @archives;
32 for my $archive (@archives) {
34 # create a new tarball with the same content as the old one
35 my $old = Archive::Tar->new($archive);
36 my $new = Archive::Tar->new();
37 $new->add_files( $old->get_files );
39 # save differently if compressed
40 my $ext = ( split /\./, $archive )[-1];
42 $ext =~ /t?gz$/ ? (COMPRESS_GZIP)
43 : $ext =~ /(tbz|bz2?)$/ ? (COMPRESS_BZIP)
46 my ( $fh, $filename ) = tempfile( UNLINK => 1 );
47 $new->write( $filename, @compress );
49 # read the archive again from disk
50 $new = Archive::Tar->new($filename);
53 local $TODO = 'Need to work out why no trailing slash';
55 # compare list of files
59 "$archive roundtrip on file names"