From: Jason Etheridge Date: Wed, 24 Jul 2013 20:11:19 +0000 (-0400) Subject: better table membership test X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=91f962b5c79b37386a20445cfc806567c1de1cef;p=working%2FEvergreen.git better table membership test Signed-off-by: Jason Etheridge --- diff --git a/Open-ILS/src/sql/Pg/make-pgtap-tests.pl b/Open-ILS/src/sql/Pg/make-pgtap-tests.pl index cc3ffb917a..cd1ef8692e 100755 --- a/Open-ILS/src/sql/Pg/make-pgtap-tests.pl +++ b/Open-ILS/src/sql/Pg/make-pgtap-tests.pl @@ -192,12 +192,22 @@ sub handle_tables { my $callback = shift; my @tables = fetch_tables($schema); + if (scalar @tables == 0) { + return; + } + + print "SELECT tables_are(\n"; + print "\t" . $dbh->quote($schema) . ",\n"; + print "\tARRAY[\n\t\t"; + print join( + ",\n\t\t", + map { $dbh->quote($_) } @tables + ); + print "\n\t],\t" . $dbh->quote("Found expected tables for schema $schema"); + print "\n);\n"; + foreach my $table ( @tables ) { print "\n-- -- table " . $dbh->quote("$schema.$table") . "\n\n"; - print "SELECT has_table(\n"; - print "\t" . $dbh->quote($schema) . ",\n"; - print "\t" . $dbh->quote($table) . ",\n"; - print "\t" . $dbh->quote("Has table $schema.$table") . "\n);\n"; $callback->($schema,$table) if $callback; } }