Author: turnstep
Date: Mon Jan 14 19:08:36 2008
New Revision: 10550

Modified:
   DBD-Pg/trunk/t/07copy.t

Log:
Handle cases where Test::Warn not installed more gracefully.


Modified: DBD-Pg/trunk/t/07copy.t
==============================================================================
--- DBD-Pg/trunk/t/07copy.t     (original)
+++ DBD-Pg/trunk/t/07copy.t     Mon Jan 14 19:08:36 2008
@@ -6,7 +6,6 @@
 use warnings;
 use Data::Dumper;
 use Test::More;
-use Test::Warn;
 use lib 't','.';
 require 'dbdpg_test_setup.pl';
 select(($|=1,select(STDERR),$|=1)[1]);
@@ -170,7 +169,13 @@
 like($@, qr{COPY command}, $t);
 
 $t=q{pg_putcopyend warns but does not die if not after a COPY statement};
-warning_like (sub { $dbh->pg_putcopyend(); }, qr/until a COPY/, $t);
+eval { require Test::Warn; };
+if ($@) {
+       pass('Skipping Test::Warn test');
+}
+else {
+       Test::Warn::warning_like (sub { $dbh->pg_putcopyend(); }, qr/until a 
COPY/, $t);
+}
 
 $t=q{pg_getcopydata does not work if we are using COPY .. FROM};
 $dbh->rollback();

Reply via email to