[Catalyst-commits] r9166 - in Test-WWW-Mechanize-Catalyst/trunk: .
t t/lib
ash at dev.catalyst.perl.org
ash at dev.catalyst.perl.org
Mon Feb 2 21:54:36 GMT 2009
Author: ash
Date: 2009-02-02 21:54:36 +0000 (Mon, 02 Feb 2009)
New Revision: 9166
Added:
Test-WWW-Mechanize-Catalyst/trunk/svn.authors
Modified:
Test-WWW-Mechanize-Catalyst/trunk/t/lib/Catty.pm
Test-WWW-Mechanize-Catalyst/trunk/t/lib/CattySession.pm
Test-WWW-Mechanize-Catalyst/trunk/t/simple.t
Log:
Make test less noisy by removing -Debug and cleaning up wide charin print errors
Added: Test-WWW-Mechanize-Catalyst/trunk/svn.authors
===================================================================
--- Test-WWW-Mechanize-Catalyst/trunk/svn.authors (rev 0)
+++ Test-WWW-Mechanize-Catalyst/trunk/svn.authors 2009-02-02 21:54:36 UTC (rev 9166)
@@ -0,0 +1 @@
+ashb = Ash Berlin <ash_github at firemirror.com>
Modified: Test-WWW-Mechanize-Catalyst/trunk/t/lib/Catty.pm
===================================================================
--- Test-WWW-Mechanize-Catalyst/trunk/t/lib/Catty.pm 2009-02-02 20:12:36 UTC (rev 9165)
+++ Test-WWW-Mechanize-Catalyst/trunk/t/lib/Catty.pm 2009-02-02 21:54:36 UTC (rev 9166)
@@ -3,9 +3,10 @@
use strict;
#use Catalyst;
-use Catalyst qw/-Debug/;
+use Catalyst;
use Cwd;
use MIME::Base64;
+use Encode qw//;
our $VERSION = '0.01';
@@ -13,8 +14,8 @@
name => 'Catty',
root => cwd . '/t/root',
);
-
Catty->setup();
+Catty->log->levels(undef);
sub default : Private {
my ( $self, $context ) = @_;
@@ -25,7 +26,8 @@
sub hello : Global {
my ( $self, $context ) = @_;
- my $html = html( "Hello", "Hi there! ☺" );
+ my $str = Encode::encode('utf-8', "\x{263A}"); # ☺
+ my $html = html( "Hello", "Hi there! $str" );
$context->response->content_type("text/html; charset=utf-8");
$context->response->output($html);
}
Modified: Test-WWW-Mechanize-Catalyst/trunk/t/lib/CattySession.pm
===================================================================
--- Test-WWW-Mechanize-Catalyst/trunk/t/lib/CattySession.pm 2009-02-02 20:12:36 UTC (rev 9165)
+++ Test-WWW-Mechanize-Catalyst/trunk/t/lib/CattySession.pm 2009-02-02 21:54:36 UTC (rev 9166)
@@ -3,7 +3,7 @@
use strict;
#use Catalyst;
-use Catalyst qw/-Debug
+use Catalyst qw/
Session
Session::State::Cookie
Session::Store::Dummy
Modified: Test-WWW-Mechanize-Catalyst/trunk/t/simple.t
===================================================================
--- Test-WWW-Mechanize-Catalyst/trunk/t/simple.t 2009-02-02 20:12:36 UTC (rev 9165)
+++ Test-WWW-Mechanize-Catalyst/trunk/t/simple.t 2009-02-02 21:54:36 UTC (rev 9166)
@@ -1,9 +1,9 @@
-#!perl -T
+#!perl
use strict;
use warnings;
use lib 'lib';
use Encode qw();
-use Test::More tests => 39;
+use Test::More tests => 37;
use lib 't/lib';
use Test::WWW::Mechanize::Catalyst 'Catty';
@@ -20,7 +20,9 @@
is( $m->base, "http://localhost/hello/" );
is( $m->ct, "text/html" );
$m->title_is("Hello");
-$m->content_contains( Encode::decode( 'utf-8', "Hi there! ☺" ) );
+my $bytes = "Hi there! ☺";
+my $chars = Encode::decode( 'utf-8', $bytes );
+$m->content_contains( $chars, qq{content contains "$bytes"});
#use Devel::Peek; Dump $m->content;
#Dump(Encode::decode('utf-8', "Hi there! ☺"));
@@ -39,7 +41,7 @@
$m->get_ok("/hello/");
is( $m->ct, "text/html" );
$m->title_is("Hello");
-$m->content_contains( Encode::decode( 'utf-8', "Hi there! ☺" ) );
+$m->content_contains( $chars, qq{content contains "$bytes"});
SKIP: {
eval { require Compress::Zlib; };
@@ -47,27 +49,28 @@
$m->get_ok("/gzipped/");
is( $m->ct, "text/html" );
$m->title_is("Hello");
- $m->content_contains( Encode::decode( 'utf-8', "Hi there! ☺" ) );
+ $m->content_contains( $chars, qq{content contains "$bytes"});
}
$m->get("$root/die/");
is( $m->status, 500 );
-is( $m->ct, "" );
-$m->title_is(undef);
-$m->content_is("");
+$m->content_like( qr!\(en\) Please come back later!);
+$m->content_unlike( qr!<a href="/hello/">Hello</a>.!);
$m->get("/die/");
is( $m->status, 500 );
-is( $m->ct, "" );
-$m->title_is(undef);
-$m->content_is("");
+$m->content_like( qr!\(en\) Please come back later!);
+$m->content_unlike( qr!<a href="/hello/">Hello</a>.!);
-$m->{catalyst_debug} = 1;
-$m->get("$root/die/");
-is( $m->status, 500 );
-is( $m->ct, "text/html" );
-$m->title_like(qr/Catty on Catalyst/);
-$m->content_like(qr/Caught exception in Catty/);
-$m->content_like(qr/erk/);
-$m->content_like(qr/This is the die page/);
-
+{
+ no warnings 'redefine';
+ ${Catty::}{debug} = sub { 1 };
+ $m->{catalyst_debug} = 1;
+ $m->get("$root/die/");
+ is( $m->status, 500 );
+ is( $m->ct, "text/html" );
+ $m->title_like(qr/Catty on Catalyst/);
+ $m->content_like(qr/Caught exception in Catty/);
+ $m->content_like(qr/erk/);
+ $m->content_like(qr/This is the die page/);
+}
More information about the Catalyst-commits
mailing list