[svn:DBD-Pg] r13098 - in DBD-Pg/trunk: . t

[email protected]
Newsgroups gmane.comp.db.postgresql.dbdpg.cvs
Message-ID <[email protected]>
Author: turnstep
Date: Tue Jul 21 08:59:39 2009
New Revision: 13098

Modified:
   DBD-Pg/trunk/README.dev
   DBD-Pg/trunk/t/00_release.t
   DBD-Pg/trunk/t/12placeholders.t
   DBD-Pg/trunk/t/99_perlcritic.t

Log:
Minor Perl::Critic inspired things.


Modified: DBD-Pg/trunk/README.dev
==============================================================================
--- DBD-Pg/trunk/README.dev	(original)
+++ DBD-Pg/trunk/README.dev	Tue Jul 21 08:59:39 2009
@@ -138,6 +138,8 @@
 t/dbdpg_test_setup.pl - Common connection, schema creation, and schema destruction subs.
   Goes through a lot of trouble to try and get a database to test with.
 
+t/00_release.t - Quick check that all version numbers match.
+
 t/00basic.t - Very basic test to see if DBI and DBD::Pg load properly. Requires Test::Warn 
   for the version warning test.
 

Modified: DBD-Pg/trunk/t/00_release.t
==============================================================================
--- DBD-Pg/trunk/t/00_release.t	(original)
+++ DBD-Pg/trunk/t/00_release.t	Tue Jul 21 08:59:39 2009
@@ -78,10 +78,10 @@
 }
 
 if ($good) {
-	pass "All version numbers are the same ($lastver)";
+	pass ("All version numbers are the same ($lastver)");
 }
 else {
-	fail 'All version numbers were not the same!';
+	fail ('All version numbers were not the same!');
 	for my $filename (sort keys %v) {
 		for my $glob (@{$v{$filename}}) {
 			my ($ver,$line) = @$glob;

Modified: DBD-Pg/trunk/t/12placeholders.t
==============================================================================
--- DBD-Pg/trunk/t/12placeholders.t	(original)
+++ DBD-Pg/trunk/t/12placeholders.t	Tue Jul 21 08:59:39 2009
@@ -145,8 +145,7 @@
 
 my @geotypes = qw/point line lseg box path polygon circle/;
 
-$dbh->do("SET search_path TO DEFAULT");
-eval { $dbh->do("DROP TABLE dbd_pg_test_geom"); }; $dbh->commit();
+eval { $dbh->do('DROP TABLE dbd_pg_test_geom'); }; $dbh->commit();
 
 $SQL = 'CREATE TABLE dbd_pg_test_geom (';
 for my $type (@geotypes) {
@@ -369,7 +368,7 @@
 	eval { $qresult = $dbh->quote($input, {pg_type => $typemap{$type}}); };
 	if ($@) {
 		if ($quoted !~ /ERROR: (.+)/) {
-			fail "$t error: $@";
+			fail ("$t error: $@");
 		}
 		else {
 			like ($@, qr{$1}, $t);
@@ -383,11 +382,11 @@
 	eval { $dbh->do("EXECUTE geotest('$input')"); };
 	if ($@) {
 		if ($rows !~ /ERROR: (.+)/) {
-			fail "$t error: $@";
+			fail ("$t error: $@");
 		}
 		else {
 			## Do any error for now: i18n worries
-			pass $t;
+			pass ($t);
 		}
 	}
 	$dbh->commit();
@@ -395,20 +394,20 @@
 	eval { $sth->execute($input); };
 	if ($@) {
 		if ($rows !~ /ERROR: (.+)/) {
-			fail $t;
+			fail ($t);
 		}
 		else {
 			## Do any error for now: i18n worries
-			pass $t;
+			pass ($t);
 		}
 	}
 	$dbh->commit();
 
 	if ($rows !~ /ERROR/) {
 		$SQL = "SELECT x$type FROM dbd_pg_test_geom";
-		my $expected = [[$rows],[$rows]];
+		$expected = [[$rows],[$rows]];
 		$result = $dbh->selectall_arrayref($SQL);
-		is_deeply($result, $expected, $t);
+		is_deeply ($result, $expected, $t);
 	}
 }
 
@@ -566,6 +565,7 @@
 	$t='Backslash quoting inside single quotes is parsed correctly with standard_conforming_strings off';
 	eval {
 		$dbh->do(q{SET standard_conforming_strings = 'off'});
+		local $dbh->{Warn} = '';
 		$sth = $dbh->prepare(q{SELECT '\', ?});
 		$sth->execute();
 		$sth->finish();
@@ -663,7 +663,7 @@
 
 ## Test quoting of booleans
 
-my %booltest = (
+my %booltest = ( ## no critic (Lax::ProhibitLeadingZeros::ExceptChmod, ValuesAndExpressions::ProhibitLeadingZeros)
 undef         => 'NULL',
 't'           => 'TRUE',
 'T'           => 'TRUE',
@@ -694,22 +694,22 @@
 '0 but truez' => 'ERROR',
 );
 
-while (my ($name,$val) = each %booltest) {
+while (my ($name,$res) = each %booltest) {
 	$name = undef if $name eq 'undef';
 	$t = sprintf 'Boolean quoting of %s',
 		defined $name ? qq{"$name"} : 'undef';
 	eval { $result = $dbh->quote($name, {pg_type => PG_BOOL}); };
 	if ($@) {
-		if ($val eq 'ERROR' and $@ =~ /Invalid boolean/) {
-			pass $t;
+		if ($res eq 'ERROR' and $@ =~ /Invalid boolean/) {
+			pass ($t);
 		}
 		else {
-			fail "Failure at $t: $@\n";
+			fail ("Failure at $t: $@");
 		}
 		$dbh->rollback();
 	}
 	else {
-		is ($result, $val, $t);
+		is ($result, $res, $t);
 	}
 }
 

Modified: DBD-Pg/trunk/t/99_perlcritic.t
==============================================================================
--- DBD-Pg/trunk/t/99_perlcritic.t	(original)
+++ DBD-Pg/trunk/t/99_perlcritic.t	Tue Jul 21 08:59:39 2009
@@ -80,7 +80,15 @@
 }
 close $fh or die qq{Could not close "$file": $!\n};
 
-## Everything in MANIFEST should also be in README.dev
+$file = 'MANIFEST.SKIP';
+open $fh, '<', $file or die qq{Could not open "$file": $!\n};
+while (<$fh>) {
+	next unless m{^(t/.*)};
+	$manfile{$1} = $.;
+}
+close $fh or die qq{Could not close "$file": $!\n};
+
+## Everything in MANIFEST[.SKIP] should also be in README.dev
 for my $file (sort keys %manfile) {
 	if (!exists $devfile{$file}) {
 		fail qq{File "$file" is in MANIFEST but not in README.dev\n};
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.