1BEGIN { chdir 't' if -d 't' }
2
3use Test::More 'no_plan';
4use strict;
5use lib '../lib';
6
7use Archive::Tar;
8use File::Spec;
9
10$Archive::Tar::WARN = 0;
11
12my $t1 = Archive::Tar->new;
13my $t2 = Archive::Tar->new;
14
15is($Archive::Tar::error, "", "global error string is empty");
16is($t1->error, "", "error string of object 1 is empty");
17is($t2->error, "", "error string of object 2 is empty");
18
19ok(!$t1->read(), "can't read without a file");
20
21isnt($t1->error, "", "error string of object 1 is set");
22is($Archive::Tar::error, $t1->error, "global error string equals that of object 1");
23is($Archive::Tar::error, Archive::Tar->error, "the class error method returns the global error");
24is($t2->error, "", "error string of object 2 is still empty");
25
26my $src = File::Spec->catfile( qw[src short b] );
27ok(!$t2->read($src), "error when opening $src");
28
29isnt($t2->error, "", "error string of object 1 is set");
30isnt($t2->error, $t1->error, "error strings of objects 1 and 2 differ");
31is($Archive::Tar::error, $t2->error, "global error string equals that of object 2");
32is($Archive::Tar::error, Archive::Tar->error, "the class error method returns the global error");
33