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