[Jifty-commit] r7054 - Jifty-DBI/trunk/t

Jifty commits jifty-commit at lists.jifty.org
Tue May 19 08:18:11 EDT 2009


Author: sartak
Date: Tue May 19 08:18:11 2009
New Revision: 7054

Modified:
   Jifty-DBI/trunk/t/03rename_column.t

Log:
Silence some intentional test warnings by testing them

Modified: Jifty-DBI/trunk/t/03rename_column.t
==============================================================================
--- Jifty-DBI/trunk/t/03rename_column.t	(original)
+++ Jifty-DBI/trunk/t/03rename_column.t	Tue May 19 08:18:11 2009
@@ -10,7 +10,7 @@
 BEGIN { require "t/utils.pl" }
 our (@available_drivers);
 
-use constant TESTS_PER_DRIVER => 9;
+use constant TESTS_PER_DRIVER => 11;
 
 my $total = scalar(@available_drivers) * TESTS_PER_DRIVER;
 plan tests => $total;
@@ -25,11 +25,9 @@
     connect_handle($handle);
     isa_ok( $handle->dbh, 'DBI::db' );
 
-    my $sth;
-
     drop_table_if_exists( 'test', $handle );
 
-    $sth = $handle->simple_query(
+    my $sth = $handle->simple_query(
         "CREATE TABLE test (a int, x integer not null default 1)"
     );
     ok $sth, 'created a table';
@@ -42,9 +40,20 @@
     $sth = $handle->simple_query("select * from test");
     is $sth->fetchrow_hashref->{'y'}, 2, 'correct value';
     $sth->finish;
+    undef $sth;
 
-    ok !eval { $handle->simple_query("insert into test(x) values(1)") }, "no x anymore";
-    ok !eval { $handle->simple_query("insert into test(y) values(NULL)") }, "NOT NULL is still there";
+    my @warnings;
+    ok !eval {
+        local $SIG{__WARN__} = sub { push @warnings, @_ };
+        $handle->simple_query("insert into test(x) values(1)");
+    }, "no x anymore";
+    ok((splice @warnings), "we got warnings");
+
+    ok !eval {
+        local $SIG{__WARN__} = sub { push @warnings, @_ };
+        $handle->simple_query("insert into test(y) values(NULL)");
+    }, "NOT NULL is still there";
+    ok((splice @warnings), "we got warnings");
 
     $handle->simple_query("delete from test");
     ok $handle->simple_query("insert into test(a) values(1)"), "DEFAULT is still there";


More information about the Jifty-commit mailing list