Commits

Shlomi Fish  committed a8782e8

Convert t/11utf8.t to Test::More.

  • Participants
  • Parent commits 97d4f4c

Comments (0)

Files changed (3)

         - t/08literal.t
         - t/09exslt.t
         - t/10functions.t
+        - t/11utf8.t
+
+    - In the process made "Encode" and perl-5.8.1. pre-requisites of this
+    distribution.
 
 1.73            Sun Oct  9 17:32:30 IST 2011
     - Possible fix for https://rt.cpan.org/Ticket/Display.html?id=71456 :
 
 
 BEGIN {
-  if ($] < 5.006_001) {
-    warn "\nSorry, at least Perl 5.6.1 is required for this module!\n\n";
+  if ($] < 5.008_001) {
+    warn "\nSorry, at least Perl 5.8.1 is required for this module!\n\n";
     exit;
   }
 }
     'VERSION_FROM' => 'LibXSLT.pm', # finds $VERSION
     'AUTHOR'    => 'Matt Sergeant',
     'ABSTRACT'  => 'Interface to Gnome libxslt library',
-    'PREREQ_PM' => { 'XML::LibXML' => "1.70", },
+    'PREREQ_PM' =>
+    { 
+        'Encode' => '0',
+        'XML::LibXML' => "1.70", 
+    },
     'OBJECT'     => '$(O_FILES)',
     %config,
 );
 use strict;                     # -*- perl -*-
-use Test;
-use constant PLAN => 32;
-BEGIN {
-  plan tests => PLAN;
-  unless (eval { require Encode; import Encode; 1 }) {
-    skip("this test requires Encode.pm\n") for (1..PLAN);
-    exit;
-  }
-}
+use warnings;
+
+use Encode;
+# Should be 32.
+use Test::More tests => 32;
 
 use XML::LibXSLT;
 use XML::LibXML;
 
 my $parser = XML::LibXML->new();
-ok( $parser );
+# TEST
+ok( $parser, ' TODO : Add test name' );
 
 my $xslt = XML::LibXSLT->new();
 
 my $doc = $parser->parse_string(<<XML);
 <unicode>\x{0100}dam</unicode>
 XML
-ok( $doc );
+# TEST
+ok( $doc, ' TODO : Add test name' );
 
 my $style_doc = $parser->parse_string(<<XSLT);
 <xsl:stylesheet version="1.0"
   </xsl:template>
 </xsl:stylesheet>
 XSLT
-ok( $style_doc );
+# TEST
+ok( $style_doc, ' TODO : Add test name' );
 
 my $stylesheet = $xslt->parse_stylesheet($style_doc);
-ok( $stylesheet );
+# TEST
+ok( $stylesheet, ' TODO : Add test name' );
 
 my $results = $stylesheet->transform($doc);
-ok( $results );
+# TEST
+ok( $results, ' TODO : Add test name' );
 
 my $output = $stylesheet->output_string( $results );
-ok( $output );
+# TEST
+ok( $output, ' TODO : Add test name' );
 
 # Test that we've correctly converted to characters seeing as the
 # output format was UTF-8.
 
-ok( Encode::is_utf8($output) );
-ok( $output, "\x{0100}dam" );
+# TEST
+ok( Encode::is_utf8($output), ' TODO : Add test name' );
+# TEST
+is( $output, "\x{0100}dam", ' TODO : Add test name' );
 
 $output = $stylesheet->output_as_chars( $results );
-ok( Encode::is_utf8($output) );
-ok( $output, "\x{0100}dam" );
+# TEST
+ok( Encode::is_utf8($output), ' TODO : Add test name' );
+# TEST
+is( $output, "\x{0100}dam", ' TODO : Add test name' );
 
 $output = $stylesheet->output_as_bytes( $results );
-ok( !Encode::is_utf8($output) );
-ok( $output, "\xC4\x80dam" );
+# TEST
+ok( !Encode::is_utf8($output), ' TODO : Add test name' );
+# TEST
+is( $output, "\xC4\x80dam", ' TODO : Add test name' );
 }
 
 # LATIN-2 character 17E - z caron
 <?xml version="1.0" encoding="UTF-8"?>
 <unicode>\x{17E}il</unicode>
 XML
-ok( $doc );
+# TEST
+ok( $doc, ' TODO : Add test name' );
 
 # no encoding: libxslt chooses either an entity or UTF-8
 {
   </xsl:template>
 </xsl:stylesheet>
 XSLT
-  ok( $style_doc );
+  # TEST
+  ok( $style_doc, ' TODO : Add test name' );
   my $stylesheet = $xslt->parse_stylesheet($style_doc);
-  ok( $stylesheet );
+  # TEST
+  ok( $stylesheet, ' TODO : Add test name' );
   my $results = $stylesheet->transform($doc);
-  ok( $results );
+  # TEST
+  ok( $results, ' TODO : Add test name' );
 
   my $output = $stylesheet->output_string( $results );  
-  ok( !Encode::is_utf8($output) );
-  ok( $output =~ /^(?:&#382;|\xC5\xBE)il/ );
+  # TEST
+  ok( !Encode::is_utf8($output), ' TODO : Add test name' );
+  # TEST
+  ok( $output =~ /^(?:&#382;|\xC5\xBE)il/, ' TODO : Add test name' );
 
   $output = $stylesheet->output_as_chars( $results );
-  ok( Encode::is_utf8($output) );
-  ok( $output, "\x{17E}il" );
+  # TEST
+  ok( Encode::is_utf8($output), ' TODO : Add test name' );
+  # TEST
+  is( $output, "\x{17E}il", ' TODO : Add test name' );
   $output = $stylesheet->output_as_bytes( $results );
-  ok( !Encode::is_utf8($output) );
-  ok( $output =~ /^(?:&#382;|\xC5\xBE)il/ );
+  # TEST
+  ok( !Encode::is_utf8($output), ' TODO : Add test name' );
+  # TEST
+  like( $output, qr/^(?:&#382;|\xC5\xBE)il/, ' TODO : Add test name' );
 }
 
 # doesn't map to latin-1 so will appear as an entity
   </xsl:template>
 </xsl:stylesheet>
 XSLT
-  ok( $style_doc );
+  # TEST
+  ok( $style_doc, ' TODO : Add test name' );
   my $stylesheet = $xslt->parse_stylesheet($style_doc);
-  ok( $stylesheet );
+  # TEST
+  ok( $stylesheet, ' TODO : Add test name' );
   my $results = $stylesheet->transform($doc);
-  ok( $results );
+  # TEST
+  ok( $results, ' TODO : Add test name' );
   my $output = $stylesheet->output_string( $results );
-  ok( $output );
+  # TEST
+  ok( $output, ' TODO : Add test name' );
 
-  ok( !Encode::is_utf8($output) );
-  ok( $output, "&#382;il" );
+  # TEST
+
+  ok( !Encode::is_utf8($output), ' TODO : Add test name' );
+  # TEST
+  is( $output, "&#382;il", ' TODO : Add test name' );
 
   $output = $stylesheet->output_as_chars( $results );
-  ok( Encode::is_utf8($output) );
-  ok( $output, "\x{17E}il" );
+  # TEST
+  ok( Encode::is_utf8($output), ' TODO : Add test name' );
+  # TEST
+  is( $output, "\x{17E}il", ' TODO : Add test name' );
 
   $output = $stylesheet->output_as_bytes( $results );
-  ok( !Encode::is_utf8($output) );
-  ok( $output, "&#382;il" );
+  # TEST
+  ok( !Encode::is_utf8($output), ' TODO : Add test name' );
+  # TEST
+  is( $output, "&#382;il", ' TODO : Add test name' );
 }