[svn:DBD-Pg] r14537 - DBD-Pg/trunk/t

[email protected]
Newsgroups gmane.comp.db.postgresql.dbdpg.cvs
Message-ID <[email protected]>
Author: turnstep
Date: Sat Nov 20 20:56:31 2010
New Revision: 14537

Modified:
   DBD-Pg/trunk/t/04misc.t

Log:
Tests for the modified data_sources()


Modified: DBD-Pg/trunk/t/04misc.t
==============================================================================
--- DBD-Pg/trunk/t/04misc.t	(original)
+++ DBD-Pg/trunk/t/04misc.t	Sat Nov 20 20:56:31 2010
@@ -18,7 +18,7 @@
 if (! $dbh) {
 	plan skip_all => 'Connection to database failed, cannot continue testing';
 }
-plan tests => 54;
+plan tests => 56;
 
 isnt ($dbh, undef, 'Connect to database for miscellaneous tests');
 
@@ -291,6 +291,29 @@
 @result = DBI->data_sources('Pg',"port=$port");
 isnt ($result[0], undef, $t);
 
+SKIP: {
+
+	$t=q{The "data_sources" method returns information when 'dbi:Pg' is uppercased};
+
+	if (! exists $ENV{DBI_DSN} or $ENV{DBI_DSN} !~ /pg/i) {
+		skip 'Cannot test data_sources() DBI_DSN munging unless DBI_DSN is set', 2;
+	}
+
+	my $orig = $ENV{DBI_DSN};
+	$ENV{DBI_DSN} =~ s/DBI:PG/DBI:PG/i;
+	@result = DBI->data_sources('Pg');
+	like ((join '' => @result), qr{template0}, $t);
+
+	$t=q{The "data_sources" method returns information when 'DBI:' is mixed case};
+
+	$ENV{DBI_DSN} =~ s/DBI:PG/dBi:pg/i;
+	@result = DBI->data_sources('Pg');
+	like ((join '' => @result), qr{template0}, $t);
+
+	$ENV{DBI_DSN} = $orig;
+
+}
+
 #
 # Test the use of $DBDPG_DEFAULT
 #
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.