X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=t%2Fdb_colinfo.t;fp=t%2Fdb_colinfo.t;h=c56fbf28497b2b954345059a1d6816474574885d;hb=8ccc7518f5fd8c8bc0964b6ba61d60757b3b09e7;hp=471d05986906b9be754d0462131088471fbbd909;hpb=8d3f7b6c5612270c10042d8e0a9e52ad4ad54a46;p=maypole.git diff --git a/t/db_colinfo.t b/t/db_colinfo.t index 471d059..c56fbf2 100755 --- a/t/db_colinfo.t +++ b/t/db_colinfo.t @@ -88,24 +88,28 @@ package main; $DB_Class = 'BeerDB::BeerTestmysql'; -my $drh = DBI->install_driver("mysql"); -my %databases = map { $_ => 1 } $drh->func('localhost', 3306, '_ListDBs'); +my $drh = eval { DBI->install_driver("mysql"); }; +$err = $@; +if ($err) { + $skip_msg = "no driver for MySQL"; +} else { + my %databases = map { $_ => 1 } $drh->func('localhost', 3306, '_ListDBs'); -unless ($databases{test}) { - my $rc = $drh->func("createdb", 'test', 'admin'); -} + unless ($databases{test}) { + my $rc = $drh->func("createdb", 'test', 'admin'); + } -%databases = map { $_ => 1 } $drh->func('localhost', 3306, '_ListDBs'); + %databases = map { $_ => 1 } $drh->func('localhost', 3306, '_ListDBs'); -if ($databases{test}) { - eval {$DB_Class->connection("dbi:mysql:$db", "$dbuser", "$dbpasswd"); }; - $err = $@; - $skip_msg = "Could not connect to MySQL using database 'test', username 'test', and password ''. Check privileges and try again."; -} else { - $err = 'no test db'; - $skip_msg = "Could not connect to MySQL using database 'test' as it doesn't exist, sorry"; + if ($databases{test}) { + eval {$DB_Class->connection("dbi:mysql:$db", "$dbuser", "$dbpasswd"); }; + $err = $@; + $skip_msg = "Could not connect to MySQL using database 'test', username 'test', and password ''. Check privileges and try again."; + } else { + $err = 'no test db'; + $skip_msg = "Could not connect to MySQL using database 'test' as it doesn't exist, sorry"; + } } - $skip_howmany = 22; SKIP: {