summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/cpan/Archive-Tar/t/06_error.t
blob: 983eb0ffae865feaf7fa16131502116205d70b43 (plain) (blame)
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
BEGIN { chdir 't' if -d 't' }

use Test::More 'no_plan';
use strict;
use lib '../lib';

use Archive::Tar;
use File::Spec;

$Archive::Tar::WARN = 0;

my $t1 = Archive::Tar->new;
my $t2 = Archive::Tar->new;

is($Archive::Tar::error, "", "global error string is empty");
is($t1->error, "", "error string of object 1 is empty");
is($t2->error, "", "error string of object 2 is empty");

ok(!$t1->read(), "can't read without a file");

isnt($t1->error, "", "error string of object 1 is set");
is($Archive::Tar::error, $t1->error, "global error string equals that of object 1");
is($Archive::Tar::error, Archive::Tar->error, "the class error method returns the global error");
is($t2->error, "", "error string of object 2 is still empty");

my $src = File::Spec->catfile( qw[src short b] );
ok(!$t2->read($src), "error when opening $src");

isnt($t2->error, "", "error string of object 1 is set");
isnt($t2->error, $t1->error, "error strings of objects 1 and 2 differ");
is($Archive::Tar::error, $t2->error, "global error string equals that of object 2");
is($Archive::Tar::error, Archive::Tar->error, "the class error method returns the global error");