[Jifty-commit] r5211 - in Jifty-DBI/trunk: t

Jifty commits jifty-commit at lists.jifty.org
Tue Mar 11 09:14:46 EDT 2008


Author: sartak
Date: Tue Mar 11 09:14:45 2008
New Revision: 5211

Modified:
   Jifty-DBI/trunk/   (props changed)
   Jifty-DBI/trunk/Makefile.PL
   Jifty-DBI/trunk/t/02-column_constraints.t

Log:
 r52489 at onn:  sartak | 2008-03-11 09:14:39 -0400
 Catch some expected warnings with (new dependency on) Test::Warn


Modified: Jifty-DBI/trunk/Makefile.PL
==============================================================================
--- Jifty-DBI/trunk/Makefile.PL	(original)
+++ Jifty-DBI/trunk/Makefile.PL	Tue Mar 11 09:14:45 2008
@@ -25,6 +25,7 @@
 requires('version');
 #requires('Class::Trigger');
 build_requires('Test::More' => 0.52);
+build_requires('Test::Warn' => 0.10);
 build_requires('DBD::SQLite');
 no_index directory => 'ex';
 features( 

Modified: Jifty-DBI/trunk/t/02-column_constraints.t
==============================================================================
--- Jifty-DBI/trunk/t/02-column_constraints.t	(original)
+++ Jifty-DBI/trunk/t/02-column_constraints.t	Tue Mar 11 09:14:45 2008
@@ -5,11 +5,12 @@
 use warnings;
 use File::Spec;
 use Test::More;# import => [qw(isa_ok skip plan)];
+use Test::Warn;
 
 BEGIN { require "t/utils.pl" }
 our (@available_drivers);
 
-use constant TESTS_PER_DRIVER => 7;
+use constant TESTS_PER_DRIVER => 9;
 
 my $total = scalar(@available_drivers) * TESTS_PER_DRIVER;
 plan tests => $total;
@@ -37,13 +38,21 @@
         ok($e_id, "Got an id for the new employee");
 
         # Test 'is mandatory'
-        $e_id = $emp->create( employee_num => '456' );
+        warning_like {
+            $e_id = $emp->create( employee_num => '456' );
+        } qr/^Did not supply value for mandatory column name/;
+
         ok(!$e_id, "Did not get an id for second new employee, good");
 
         # Test 'is distinct'
         $e_id = $emp->create( name => 'Foo', employee_num => '456' );
         ok($e_id, "Was able to create a second record successfully");
-        my $e_id2 = $emp->create( name => 'Bar', employee_num => '123' );
+        my $e_id2;
+
+        warning_like {
+            $e_id2 = $emp->create( name => 'Bar', employee_num => '123' );
+        } qr/^TestApp::Employee=HASH\(\w+\) failed a 'is_distinct' check for employee_num on 123/;
+
         ok(!$e_id2, "is_distinct prevents us from creating another record");
         my $obj = TestApp::Employee->new( handle => $handle );
         $obj->load( $e_id );


More information about the Jifty-commit mailing list