From 91f962b5c79b37386a20445cfc806567c1de1cef Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Wed, 24 Jul 2013 16:11:19 -0400 Subject: [PATCH] better table membership test Signed-off-by: Jason Etheridge --- Open-ILS/src/sql/Pg/make-pgtap-tests.pl | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) 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; } } -- 2.11.0