File: 06_error.t

package info (click to toggle)
perl 5.20.2-3%2Bdeb8u11
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 102,964 kB
  • sloc: perl: 555,553; ansic: 214,041; sh: 38,121; pascal: 8,783; cpp: 3,895; makefile: 2,393; xml: 2,325; yacc: 1,741
file content (32 lines) | stat: -rw-r--r-- 1,148 bytes parent folder | download | duplicates (9)
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");