File: 010openbsd.t

package info (click to toggle)
libarchive-tar-wrapper-perl 0.42-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 372 kB
  • sloc: perl: 782; makefile: 2
file content (35 lines) | stat: -rw-r--r-- 1,105 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use warnings;
use strict;
use Test::More tests => 7;
use Archive::Tar::Wrapper;
use File::Spec;
use File::Which qw(which);

SKIP: {
    skip 'This test is designed to run only on OpenBSD', 7
      unless ( $^O eq 'openbsd' );
    my $tar_path = which('tar');
    note("tar available at $tar_path");

    my $tar = Archive::Tar::Wrapper->new( tar_read_options => 'p' );

    is( $tar->{tar_read_options},
        '-p', 'tar parameters on OpenBSD have a "-" prefix' );
    ok( $tar->_is_openbsd(), 'correctly identify the OS' );
    is_deeply(
        $tar->_read_openbsd_opts('z'),
        [ "$tar_path", '-z', '-x', '-p' ],
        'got correct options for gziped tarball'
    ) or diag( explain( $tar->_read_openbsd_opts('z') ) );
    is_deeply(
        $tar->_read_openbsd_opts('j'),
        [ "$tar_path", '-j', '-x', '-p' ],
        'got correct options for bziped tarball'
    ) or diag( explain( $tar->_read_openbsd_opts('j') ) );

    for my $file (qw(bar.tar foo.tgz foo.tar.bz2)) {
        ok( $tar->read( File::Spec->catfile( 't', 'data', $file ) ),
            "read tarball $file" );
    }
}