[Catalyst-commits] r9571 - in trunk/Catalyst-Log-Log4perl: . t
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Tue Mar 24 02:36:42 GMT 2009
Author: t0m
Date: 2009-03-24 02:36:41 +0000 (Tue, 24 Mar 2009)
New Revision: 9571
Added:
trunk/Catalyst-Log-Log4perl/t/20-test-log4perl.t
trunk/Catalyst-Log-Log4perl/t/21-test-log4perl-hotfix.t
trunk/Catalyst-Log-Log4perl/t/22-test-log4perl-hotfix-broken.t
Modified:
trunk/Catalyst-Log-Log4perl/Changes
Log:
Tests from mailing list
Modified: trunk/Catalyst-Log-Log4perl/Changes
===================================================================
--- trunk/Catalyst-Log-Log4perl/Changes 2009-03-24 02:10:46 UTC (rev 9570)
+++ trunk/Catalyst-Log-Log4perl/Changes 2009-03-24 02:36:41 UTC (rev 9571)
@@ -1,5 +1,7 @@
Revision history for Catalyst::Log::Log4perl
+ - Add tests using Test::Log4perl contributed by Sebastian Willert
+
1.03 Sat Mar 21 20:52:20 GMT 2009
- Fix to work correctly with Log::Dispatch::Email::MailSend, which
is recommended in the documentation (Sebastian Willert)
Added: trunk/Catalyst-Log-Log4perl/t/20-test-log4perl.t
===================================================================
--- trunk/Catalyst-Log-Log4perl/t/20-test-log4perl.t (rev 0)
+++ trunk/Catalyst-Log-Log4perl/t/20-test-log4perl.t 2009-03-24 02:36:41 UTC (rev 9571)
@@ -0,0 +1,36 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib ( "$FindBin::Bin/lib", "$FindBin::Bin/../lib" );
+
+use Catalyst::Test 'MockApp';
+use Test::More;
+
+BEGIN {
+ eval "use Test::Log4perl;";
+ if ($@) {
+ plan skip_all => 'Test::Log4perl required for testing logging';
+ } else {
+ plan tests => 2;
+ }
+}
+
+my $tlogger = Test::Log4perl->get_logger("MockApp.Controller.Root");
+
+TODO: {
+ local $TODO = 'First request without prev. get_logger fails';
+ Test::Log4perl->start();
+ $tlogger->warn ("root/foo");
+ get('/foo');
+ Test::Log4perl->end('Got all log messages');
+}
+
+Test::Log4perl->start();
+$tlogger->warn ("root/foo");
+get('/foo');
+Test::Log4perl->end('The second request send all log messages');
+
+
Added: trunk/Catalyst-Log-Log4perl/t/21-test-log4perl-hotfix.t
===================================================================
--- trunk/Catalyst-Log-Log4perl/t/21-test-log4perl-hotfix.t (rev 0)
+++ trunk/Catalyst-Log-Log4perl/t/21-test-log4perl-hotfix.t 2009-03-24 02:36:41 UTC (rev 9571)
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib ( "$FindBin::Bin/lib", "$FindBin::Bin/../lib" );
+
+use Catalyst::Test 'MockApp';
+use Test::More;
+
+BEGIN {
+ eval "use Test::Log4perl;";
+ if ($@) {
+ plan skip_all => 'Test::Log4perl required for testing logging';
+ } else {
+ plan tests => 1;
+ }
+}
+
+my $tlogger = Test::Log4perl->get_logger("MockApp.Controller.Root");
+Log::Log4perl->get_logger("MockApp.Controller.Root");
+
+Test::Log4perl->start();
+$tlogger->warn("root/foo");
+get('/foo');
+Test::Log4perl->end('Got log messages after initial get_logger call');
+
+
Added: trunk/Catalyst-Log-Log4perl/t/22-test-log4perl-hotfix-broken.t
===================================================================
--- trunk/Catalyst-Log-Log4perl/t/22-test-log4perl-hotfix-broken.t (rev 0)
+++ trunk/Catalyst-Log-Log4perl/t/22-test-log4perl-hotfix-broken.t 2009-03-24 02:36:41 UTC (rev 9571)
@@ -0,0 +1,37 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib ( "$FindBin::Bin/lib", "$FindBin::Bin/../lib" );
+
+use Catalyst::Test 'MockApp';
+use Test::More;
+
+BEGIN {
+ eval "use Test::Log4perl;";
+ if ($@) {
+ plan skip_all => 'Test::Log4perl required for testing logging';
+ } else {
+ plan tests => 2;
+ }
+}
+
+my $tlogger = Test::Log4perl->get_logger("MockApp.Controller.Root");
+Log::Log4perl->get_logger("MockApp");
+
+TODO: {
+ local $TODO = 'First request with get_logger in root category fails';
+ Test::Log4perl->start();
+ $tlogger->warn ("root/foo");
+ get('/foo');
+ Test::Log4perl->end('Got all log messages');
+}
+
+Test::Log4perl->start();
+$tlogger->warn ("root/foo");
+get('/foo');
+Test::Log4perl->end('The second request send all log messages');
+
+
More information about the Catalyst-commits
mailing list