[Catalyst-commits] r9965 - in
trunk/Catalyst-Plugin-Unicode-Encoding: .
lib/Catalyst/Plugin/Unicode t t/lib
ash at dev.catalyst.perl.org
ash at dev.catalyst.perl.org
Thu Apr 30 18:12:49 GMT 2009
Author: ash
Date: 2009-04-30 19:12:49 +0100 (Thu, 30 Apr 2009)
New Revision: 9965
Added:
trunk/Catalyst-Plugin-Unicode-Encoding/t/05config.t
Modified:
trunk/Catalyst-Plugin-Unicode-Encoding/Changes
trunk/Catalyst-Plugin-Unicode-Encoding/lib/Catalyst/Plugin/Unicode/Encoding.pm
trunk/Catalyst-Plugin-Unicode-Encoding/t/04live.t
trunk/Catalyst-Plugin-Unicode-Encoding/t/lib/TestApp.pm
Log:
Fix bug with setting encoding in config (test from abraxxa)
Modified: trunk/Catalyst-Plugin-Unicode-Encoding/Changes
===================================================================
--- trunk/Catalyst-Plugin-Unicode-Encoding/Changes 2009-04-30 17:34:36 UTC (rev 9964)
+++ trunk/Catalyst-Plugin-Unicode-Encoding/Changes 2009-04-30 18:12:49 UTC (rev 9965)
@@ -9,6 +9,7 @@
- Handles the latin-1 (i.e. e-accute) case of encoding that everyone
else forgets
- Copy live tests from Catalyst::Plugin::Encoding
+ - Fix bug with setting encoding in config (test from abraxxa)
0.2 2009-04-28 11:43:00
- Switch to MRO::Compat for Catalyst 5.8
Modified: trunk/Catalyst-Plugin-Unicode-Encoding/lib/Catalyst/Plugin/Unicode/Encoding.pm
===================================================================
--- trunk/Catalyst-Plugin-Unicode-Encoding/lib/Catalyst/Plugin/Unicode/Encoding.pm 2009-04-30 17:34:36 UTC (rev 9964)
+++ trunk/Catalyst-Plugin-Unicode-Encoding/lib/Catalyst/Plugin/Unicode/Encoding.pm 2009-04-30 18:12:49 UTC (rev 9965)
@@ -15,6 +15,7 @@
sub encoding {
my $c = shift;
my $encoding;
+
if ( scalar @_ ) {
# Let it be set to undef
if (my $wanted = shift) {
@@ -91,7 +92,7 @@
my $conf = $self->config;
# Allow an explict undef encoding to disable default of utf-8
- my $enc = exists $conf->{encoding} ? $conf->{encoding} : 'UTF-8';
+ my $enc = exists $conf->{encoding} ? delete $conf->{encoding} : 'UTF-8';
$self->encoding( $enc );
return $self->next::method(@_);
Modified: trunk/Catalyst-Plugin-Unicode-Encoding/t/04live.t
===================================================================
--- trunk/Catalyst-Plugin-Unicode-Encoding/t/04live.t 2009-04-30 17:34:36 UTC (rev 9964)
+++ trunk/Catalyst-Plugin-Unicode-Encoding/t/04live.t 2009-04-30 18:12:49 UTC (rev 9965)
@@ -84,3 +84,4 @@
'content string matches from latin1'
);
}
+
Added: trunk/Catalyst-Plugin-Unicode-Encoding/t/05config.t
===================================================================
--- trunk/Catalyst-Plugin-Unicode-Encoding/t/05config.t (rev 0)
+++ trunk/Catalyst-Plugin-Unicode-Encoding/t/05config.t 2009-04-30 18:12:49 UTC (rev 9965)
@@ -0,0 +1,24 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use Test::More tests => 2;
+
+BEGIN { $ENV{TESTAPP_ENCODING} = 'UTF-8' };
+
+# setup library path
+use FindBin qw($Bin);
+use lib "$Bin/lib";
+
+# make sure testapp works
+BEGIN {
+use_ok('TestApp') };
+
+use Test::WWW::Mechanize::Catalyst 'TestApp';
+my $mech = Test::WWW::Mechanize::Catalyst->new;
+
+{
+ TestApp->encoding('UTF-8');
+ $mech->get_ok('http://localhost/unicode', 'encoding configured ok');
+}
+
Modified: trunk/Catalyst-Plugin-Unicode-Encoding/t/lib/TestApp.pm
===================================================================
--- trunk/Catalyst-Plugin-Unicode-Encoding/t/lib/TestApp.pm 2009-04-30 17:34:36 UTC (rev 9964)
+++ trunk/Catalyst-Plugin-Unicode-Encoding/t/lib/TestApp.pm 2009-04-30 18:12:49 UTC (rev 9965)
@@ -4,6 +4,10 @@
use Catalyst qw/Unicode::Encoding/;
+__PACKAGE__->config(
+ encoding => $ENV{TESTAPP_ENCODING}
+) if $ENV{TESTAPP_ENCODING};
+
__PACKAGE__->setup;
1;
More information about the Catalyst-commits
mailing list