make test fails for URI and HTML::Parser unless defined $Config{useperlio}

[email protected] (Torsten Förtsch)
Newsgroups perl.libwww
Message-ID <[email protected]>
Hi,

testing URI and HTML::Parser fails if perl is compiled w/o perlio (not much of 
a deal nowadays).

Please consider the following patches.

1. URI

--- t/iri.t~    2010-01-16 08:08:39.000000000 +0100          
+++ t/iri.t     2010-04-07 16:18:37.502602019 +0200          
@@ -2,7 +2,14 @@                                             
                                                             
 use utf8;                                                   
 use strict;                                                 
-use Test::More tests => 26;                                 
+use Test::More;                                             
+use Config;                                                 
+                                                            
+if (defined $Config{useperlio}) {                           
+    plan tests=>26;                                         
+} else {                                                    
+    plan skip_all=>'this perl doesn\'t support PerlIO layers';
+}                                                             
                                                               
 use URI;                                                      
 use URI::IRI;                                                 


2. HTML::Parser

--- t/unicode.t~        2008-11-17 11:34:35.000000000 +0100              
+++ t/unicode.t 2010-04-07 16:38:04.213354373 +0200                      
@@ -139,32 +139,38 @@                                                    
 is(@warn, 1);                                                           
 like($warn[0], qr/^Parsing of undecoded UTF-8 will give garbage when decoding 
entities/);
                                                                                          
-@warn = ();                                                                              
-@parsed = ();                                                                            
-open($fh, "<:raw:utf8", $file) || die;                                                   
-$p->parse_file($fh);                                                                     
-is(@parsed, "11");                                                                       
-is($parsed[6][0], "start");                                                              
-is($parsed[6][8]{id}, "\x{2665}\x{2665}");                                               
-is($parsed[7][0], "text");                                                               
-is($parsed[7][1], "&hearts; Love \x{2665}");                                             
-is($parsed[7][2], "\x{2665} Love \x{2665}");                                             
-is($parsed[10][3], (-s $file) - 2 * 4);                                                  
-is(@warn, 0);                                                                            
+SKIP: {                                                                                  
+    use Config;                                                                          
+    skip 'this perl doesn\'t support PerlIO layers', 16                                  
+        unless defined $Config{useperlio};                                               
                                                                                          
-@warn = ();                                                                              
-@parsed = ();                                                                            
-open($fh, "<:raw", $file) || die;                                                        
-$p->utf8_mode(1);                                                                        
-$p->parse_file($fh);                                                                     
-is(@parsed, "11");
-is($parsed[6][0], "start");
-is($parsed[6][8]{id}, "\xE2\x99\xA5\xE2\x99\xA5");
-is($parsed[7][0], "text");
-is($parsed[7][1], "&hearts; Love \xE2\x99\xA5");
-is($parsed[7][2], "\xE2\x99\xA5 Love \xE2\x99\xA5");
-is($parsed[10][3], -s $file);
-is(@warn, 0);
+    @warn = ();
+    @parsed = ();
+    open($fh, "<:raw:utf8", $file) || die;
+    $p->parse_file($fh);
+    is(@parsed, "11");
+    is($parsed[6][0], "start");
+    is($parsed[6][8]{id}, "\x{2665}\x{2665}");
+    is($parsed[7][0], "text");
+    is($parsed[7][1], "&hearts; Love \x{2665}");
+    is($parsed[7][2], "\x{2665} Love \x{2665}");
+    is($parsed[10][3], (-s $file) - 2 * 4);
+    is(@warn, 0);
+
+    @warn = ();
+    @parsed = ();
+    open($fh, "<:raw", $file) || die;
+    $p->utf8_mode(1);
+    $p->parse_file($fh);
+    is(@parsed, "11");
+    is($parsed[6][0], "start");
+    is($parsed[6][8]{id}, "\xE2\x99\xA5\xE2\x99\xA5");
+    is($parsed[7][0], "text");
+    is($parsed[7][1], "&hearts; Love \xE2\x99\xA5");
+    is($parsed[7][2], "\xE2\x99\xA5 Love \xE2\x99\xA5");
+    is($parsed[10][3], -s $file);
+    is(@warn, 0);
+}

 unlink($file);



Torsten Förtsch

-- 
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.