[PATCH] skip some tests when Compress::Zlib is not installed

[PATCH] skip some tests when Compress::Zlib is not installed

am 02.05.2005 23:07:18 von Jose.auguste-etienne

--=-u640Gr2jntu0yNP92k30
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8

Hi everybody,

According to http://search.cpan.org/src/GAAS/libwww-perl-5.803/README

Compress::Zlib is recommended to be installed, but it is not mandatory.

The attached patch helps to avoid these failures

base/message..........NOK 83# Test 83 got: (base/message.t at
line 322)
# Expected: "\x{FEFF}Hi there \x{263A}\n"
# base/message.t line 322 is: sub { eval
{ $m->decoded_content } }, "\x{FEFF}Hi there \x{263A}\n");
base/message..........NOK 86# Test 86 got: (base/message.t at
line 331)
# Expected: "\x{FEFF}Hi there \x{263A}\n"
# base/message.t line 331 is: sub { eval
{ $m->decoded_content } }, "\x{FEFF}Hi there \x{263A}\n");
base/message..........FAILED tests 83, 86
Failed 2/92 tests, 97.83% okay


The "require Compress::Zlib" line in lib/HTTP/Message.pm
does not seem to be trapped by "eval { $m->decoded_content }",
in t/base/Message.t
* maybe a side effect of the enclosing "sub { }" around eval, huh ??? *

HTH

José

--=-u640Gr2jntu0yNP92k30
Content-Transfer-Encoding: 7bit
Content-Type: text/x-patch; charset=UTF-8
Content-Disposition: inline; filename=libwww-perl-5.803.testskip.patch
Content-Description: ibwww-perl-5.803.testskip.patch

--- libwww-perl-5.803/t/base/message.t.orig Mon May 2 20:56:11 2005
+++ libwww-perl-5.803/t/base/message.t Mon May 2 21:52:15 2005
@@ -317,8 +317,10 @@
$m->content_type("text/plain; charset=UTF-8");
$m->content("H4sICFWAq0ECA3h4eAB7v3u/R6ZCSUZqUarCoxm7uAAZKHX iEAAAAA==\n");

+eval { require Compress::Zlib; };
+my $_cz = $@;
$@ = "";
-skip($] < 5.008 ? "No Encode module" : "",
+skip($] < 5.008 ? "No Encode module" : $_cz ? "No Compress::Zlib module" : "",
sub { eval { $m->decoded_content } }, "\x{FEFF}Hi there \x{263A}\n");
ok($@ || "", "");
ok($m->content, "H4sICFWAq0ECA3h4eAB7v3u/R6ZCSUZqUarCoxm7uAAZKHXiEAAAAA==\n" );
@@ -327,7 +329,7 @@
$m->content($tmp);
$m->header("Content-Encoding", "gzip");
$@ = "";
-skip($] < 5.008 ? "No Encode module" : "",
+skip($] < 5.008 ? "No Encode module" : $_cz ? "No Compress::Zlib module" : "",
sub { eval { $m->decoded_content } }, "\x{FEFF}Hi there \x{263A}\n");
ok($@ || "", "");
ok($m->content, $tmp);

--=-u640Gr2jntu0yNP92k30--