[MKDoc-commit] [Petal] tests 088 & 089 check for correct decode_charset behaviour

bruno at mkdoc.demon.co.uk bruno at mkdoc.demon.co.uk
Wed Mar 16 13:18:05 GMT 2005


Log Message:
-----------
[Petal] tests 088 & 089 check for correct decode_charset behaviour

Modified Files:
--------------
    Petal:
        Changes

Added Files:
-----------
    Petal/t:
        088_latin1.t
        089_utf-8.t
    Petal/t/data:
        latin1.xml
        utf-8.xml

-------------- next part --------------
Index: Changes
===================================================================
RCS file: /var/spool/cvs/Petal/Changes,v
retrieving revision 1.130
retrieving revision 1.131
diff -LChanges -LChanges -u -r1.130 -r1.131
--- Changes
+++ Changes
@@ -7,6 +7,7 @@
     - Added tests 085 & 086 demonstrating breakage when using {disk,mem} cache and multi-language includes
     - $Petal::Hash::String::VARIABLE_RE_BRACKETS no longer treats ${1} as a variable
     - Fix that adds language to the mix when generating cache keys
+    - tests 088 & 089 check for correct decode_charset behaviour
 
 2.15 Wed Jan  5 15:31:00 2005
     - Fixed some 'used of uninitialized values' warnings
--- /dev/null
+++ t/089_utf-8.t
@@ -0,0 +1,19 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use lib ('lib');
+use Test::More 'no_plan';
+use Petal;
+
+$Petal::BASE_DIR = './t/data/';
+$Petal::DISK_CACHE = 0;
+$Petal::MEMORY_CACHE = 0;
+$Petal::TAINT = 1;
+
+my $template = new Petal (file => 'utf-8.xml', decode_charset => 'utf-8');
+my $string   = $template->process;
+my $copy     = chr (169);
+my $acirc    = chr (194);
+
+like   ($string, qr/$copy/);
+unlike ($string, qr/$acirc/);
--- /dev/null
+++ t/088_latin1.t
@@ -0,0 +1,23 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use lib ('lib');
+use Test::More 'no_plan';
+use Petal;
+
+$Petal::BASE_DIR = './t/data/';
+$Petal::DISK_CACHE = 0;
+$Petal::MEMORY_CACHE = 0;
+$Petal::TAINT = 1;
+
+my $template = new Petal (file => 'latin1.xml', decode_charset => 'latin1');
+my $string   = $template->process;
+my $copy     = chr (169);
+my $acirc    = chr (194);
+
+TODO: {
+    local $TODO = 'decode_charset only works when we are using utf-8';
+
+like   ($string, qr/$copy/);
+};
+unlike ($string, qr/$acirc/);
--- /dev/null
+++ t/data/utf-8.xml
@@ -0,0 +1 @@
+<p>A copyright ?? symbol</p>
--- /dev/null
+++ t/data/latin1.xml
@@ -0,0 +1 @@
+<p>A copyright ? symbol</p>


More information about the MKDoc-commit mailing list