From 7472c75bfdee4616196882f822d38f48bfa1040a Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Wed, 24 Jul 2013 16:14:43 -0400 Subject: [PATCH] better view 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 cd1ef8692e..a6ec7846d8 100755 --- a/Open-ILS/src/sql/Pg/make-pgtap-tests.pl +++ b/Open-ILS/src/sql/Pg/make-pgtap-tests.pl @@ -217,12 +217,22 @@ sub handle_views { my $callback = shift; my @views = fetch_views($schema); + if (scalar @views == 0) { + return; + } + + print "SELECT views_are(\n"; + print "\t" . $dbh->quote($schema) . ",\n"; + print "\tARRAY[\n\t\t"; + print join( + ",\n\t\t", + map { $dbh->quote($_) } @views + ); + print "\n\t],\t" . $dbh->quote("Found expected views for schema $schema"); + print "\n);\n"; + foreach my $view ( @views ) { print "\n-- -- view " . $dbh->quote("$schema.$view") . "\n\n"; - print "SELECT has_view(\n"; - print "\t" . $dbh->quote($schema) . ",\n"; - print "\t" . $dbh->quote($view) . ",\n"; - print "\t" . $dbh->quote("Has view $schema.$view") . "\n);\n"; $callback->($schema,$view) if $callback; } } -- 2.11.0