[Rt-commit] r10274 - in rt/branches/3.7-EXPERIMENTAL: lib/RT t/api
clkao at bestpractical.com
clkao at bestpractical.com
Wed Jan 9 14:28:53 EST 2008
Author: clkao
Date: Wed Jan 9 14:28:52 2008
New Revision: 10274
Modified:
rt/branches/3.7-EXPERIMENTAL/lib/RT/Test.pm
rt/branches/3.7-EXPERIMENTAL/sbin/rt-test-dependencies.in
rt/branches/3.7-EXPERIMENTAL/t/api/date.t
Log:
* Use Test::Warn and Log::Dispatch::Perl to expect warnings from
tests.
* make api/date.t quiet.
Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Test.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Test.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Test.pm Wed Jan 9 14:28:52 2008
@@ -91,6 +91,14 @@
}
RT->Init;
+
+ my $screen_logger = $RT::Logger->remove( 'screen' );
+ require Log::Dispatch::Perl;
+ $RT::Logger->add( Log::Dispatch::Perl->new
+ ( name => 'rttest',
+ min_level => $screen_logger->min_level,
+ action => { error => 'warn',
+ critical => 'warn' } ) );
}
my $created_new_db; # have we created new db? mainly for parallel testing
Modified: rt/branches/3.7-EXPERIMENTAL/sbin/rt-test-dependencies.in
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/sbin/rt-test-dependencies.in (original)
+++ rt/branches/3.7-EXPERIMENTAL/sbin/rt-test-dependencies.in Wed Jan 9 14:28:52 2008
@@ -274,6 +274,8 @@
Test::Deep 0 # needed for shredder tests
String::ShellQuote 0 # needed for gnupg-incoming.t
Test::HTTP::Server::Simple
+Log::Dispatch::Perl
+Test::Warn
.
$deps{'FASTCGI'} = [ text_to_hash( << '.') ];
Modified: rt/branches/3.7-EXPERIMENTAL/t/api/date.t
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/t/api/date.t (original)
+++ rt/branches/3.7-EXPERIMENTAL/t/api/date.t Wed Jan 9 14:28:52 2008
@@ -1,10 +1,11 @@
#!/usr/bin/perl
-use Test::More tests => 164;
+use Test::More tests => 165;
use warnings; use strict;
use RT::Test;
use RT::User;
+use Test::Warn;
use_ok('RT::Date');
{
@@ -215,11 +216,13 @@
is($date->RFC2822( Timezone => 'user' ), 'Fri, 1 Jul 2005 11:10:00 -0400', "RFC2822");
}
+warning_like
{ # bad format
my $date = RT::Date->new($RT::SystemUser);
$date->Set( Format => 'bad' );
is($date->Unix, 0, "bad format");
-}
+} qr'Unknown Date format: bad';
+
{ # setting value via Unix method
my $date = RT::Date->new($RT::SystemUser);
@@ -240,7 +243,9 @@
{ # set+ISO format
my $date = RT::Date->new($RT::SystemUser);
- $date->Set(Format => 'ISO', Value => 'weird date');
+ warning_like {
+ $date->Set(Format => 'ISO', Value => 'weird date');
+ } qr/Couldn't parse date 'weird date' as a ISO format/;
is($date->Unix, 0, "date was wrong => unix == 0");
# XXX: ISO format has more feature than we suport
More information about the Rt-commit
mailing list