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