Skip Menu |

This queue is for tickets about the XML-Dumper CPAN distribution.

Report information
The Basics
Id: 4383
Status: resolved
Priority: 0/
Queue: XML-Dumper

People
Owner: Nobody in particular
Requestors: steve [...] fisharerojo.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.67
Fixed in: (no value)



Subject: skip not working in Test 06_compression.t
In t/06_compression.t, there is a skip() used if the module Compress::Zlib is not installed. Although the test correctly identifies that the module is not installed, the test is still run and will fail because Compress::Zlib is not installed. See my example below. [root@gandalf XML-Dumper-0.67]# perl t/06_compression.t 1..1 # Running under perl version 5.008001 for linux # Current time local: Thu Nov 13 08:42:06 2003 # Current time GMT: Thu Nov 13 14:42:06 2003 # Using Test.pm version 1.24 ok 1 # skip Undefined subroutine &Compress::Zlib::gzopen called at t/06_compression.t line 36. Now, I was able to get the test working using Test::More. Attached is a patch with the updated test. [root@gandalf XML-Dumper-0.67]# perl -v This is perl, v5.8.1 built for i386-linux-thread-multi Copyright 1987-2003, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using `man perl' or `perldoc perl'. If you have access to the Internet, point your browser at http://www.perl.com/, the Perl Home Page. [root@gandalf XML-Dumper-0.67]# uname -a Linux gandalf.XXXXXX.XXX.XXX 2.4.22-1.2115.nptl #1 Wed Oct 29 15:42:51 EST 2003 i686 i686 i386 GNU/Linux
--- 06_compression.t.orig 2003-11-13 09:24:53.000000000 -0600 +++ 06_compression.t 2003-11-13 09:27:02.000000000 -0600 @@ -1,38 +1,28 @@ use strict; use warnings; -use Test; +use Test::More; use XML::Dumper; -BEGIN { plan tests => 1 } - -our $COMPRESSION_AVAILABLE; - -INIT { - eval { require Compress::Zlib; }; - if( $@ ) { - $COMPRESSION_AVAILABLE = 0; - } else { - $COMPRESSION_AVAILABLE = 1; - } +BEGIN { + eval { require Compress::Zlib; }; + print "Return: $@\n"; + if($@){ + plan skip_all => 'Compress::Zlib is not installed'; + } + else{ + plan tests => 1; + } } -sub check( $ ); - -check "Gzip Compression"; - # ============================================================ -sub check( $ ) { +{ # ============================================================ # Richard Evans provided gzip header signature test code # (twice, cuz I lost it the first time), 22 Jul 2003 # ------------------------------------------------------------ my $test = shift; - if( not $COMPRESSION_AVAILABLE ) { - skip( 1, 'Compress::Zlib not installed; compression feature disabled' ); - } - my $gz = Compress::Zlib::gzopen( 't/data/compression.xml.gz', 'rb' ); my @xml; my $buffer;
Wow, I'm sorry I missed this great patch all this time! That'll learn me to not check CPAN. I'll incorporate this right now. Thanks, - m. [guest - Thu Nov 13 10:29:06 2003]: Show quoted text
> In t/06_compression.t, there is a skip() used if the module > Compress::Zlib is not installed. Although the test correctly > identifies that the module is not installed, the test is still run > and will fail because Compress::Zlib is not installed. See my > example below. > > [root@gandalf XML-Dumper-0.67]# perl t/06_compression.t > 1..1 > # Running under perl version 5.008001 for linux > # Current time local: Thu Nov 13 08:42:06 2003 > # Current time GMT: Thu Nov 13 14:42:06 2003 > # Using Test.pm version 1.24 > ok 1 # skip > Undefined subroutine &Compress::Zlib::gzopen called at > t/06_compression.t line 36. > > Now, I was able to get the test working using Test::More. Attached is > a patch with the updated test. > > [root@gandalf XML-Dumper-0.67]# perl -v > > This is perl, v5.8.1 built for i386-linux-thread-multi > > Copyright 1987-2003, Larry Wall > > Perl may be copied only under the terms of either the Artistic License > or the > GNU General Public License, which may be found in the Perl 5 source > kit. > > Complete documentation for Perl, including FAQ lists, should be found > on > this system using `man perl' or `perldoc perl'. If you have access to > the > Internet, point your browser at http://www.perl.com/, the Perl Home > Page. > > [root@gandalf XML-Dumper-0.67]# uname -a > Linux gandalf.XXXXXX.XXX.XXX 2.4.22-1.2115.nptl #1 Wed Oct 29 15:42:51 > EST 2003 i686 i686 i386 GNU/Linux