12 plan(skip_all => "Destroy not supported in Perl $]")
13 if $] == 5.008 || ( $] >= 5.005 && $] < 5.006) ;
15 # use Test::NoWarnings, if available
18 if eval { require Test::NoWarnings ; import Test::NoWarnings; 1 };
20 plan tests => 15 + $extra ;
28 my $CompressClass = identify();
29 my $UncompressClass = getInverse($CompressClass);
30 my $Error = getErrorRef($CompressClass);
31 my $UnError = getErrorRef($UncompressClass);
33 title "Testing $CompressClass";
36 # Check that the class destructor will call close
38 my $lex = new LexFile my $name ;
47 ok my $x = new $CompressClass $name, -AutoClose => 1 ;
49 ok $x->write($hello) ;
52 is anyUncompress($name), $hello ;
56 # Tied filehandle destructor
59 my $lex = new LexFile my $name ;
66 my $fh = new IO::File "> $name" ;
69 ok my $x = new $CompressClass $fh, -AutoClose => 1 ;
74 ok anyUncompress($name) eq $hello ;
78 title "Testing DESTROY doesn't clobber \$! etc ";
80 my $lex = new LexFile my $name ;
86 ok my $z = new $CompressClass($name);
90 cmp_ok $!, '==', 22, ' $! is 22';
93 cmp_ok $!, '==', 22, " \$! has not been changed by $CompressClass destructor";
98 ok my $x = new $UncompressClass($name, -Append => 1) ;
101 1 while ($len = $x->read($result)) > 0 ;
105 cmp_ok $!, '==', 22, ' $! is 22';
108 cmp_ok $!, '==', 22, " \$! has not been changed by $UncompressClass destructor";
110 is $result, "abc", " Got uncompressed content ok";