This is an automated email from the git hooks/post-receive script. myon pushed a commit to branch master in repository libtap-parser-sourcehandler-pgtap-perl.
commit 14a9644ee286cd4b8f979ce231bf51347d8340bd Author: Christoph Berg <m...@debian.org> Date: Tue Mar 28 20:05:42 2017 +0200 New upstream version 3.33 --- Changes | 15 ++++-- META.json | 6 +-- META.yml | 6 +-- README | 2 +- bin/pg_prove | 2 +- bin/pg_tapgen | 93 +++++++++++++++++++++++++++++++++-- lib/TAP/Parser/SourceHandler/pgTAP.pm | 4 +- t/source_handler.t | 2 +- 8 files changed, 112 insertions(+), 18 deletions(-) diff --git a/Changes b/Changes index 90bd2bc..ca4ccdb 100644 --- a/Changes +++ b/Changes @@ -1,15 +1,24 @@ Revision history for Perl extension TAP::Parser::SourceHandler::pgTAP. +3.33 2017-03-04T23:40:01Z + - Added trigger-testing functions to the output of `pg_tapgen`, thanks to + Rodolphe Quiédeville (PR #11). + - Added enum- and extension-testing functions to the output of + `pg_tapgen`, thanks to Rodolphe Quiédeville (PR #13, PR #14). + - Explicitly set the `psql` `pager` variable to `off`, instead of not + setting it, to ensure it is always off. Thanks to Keith Fiske for the + report (theory/pgtap#135). + 3.32 2016-05-11T23:37:30Z - Fixed quoting of default values output by `pg_tapgen`, thanks to a pull request from Rodolphe Quiédeville (#7). - - Various fixes and imrovements to `pg_tapgen`, including: + - Various fixes and improvements to `pg_tapgen`, including: - Added `--create-extension` and `--no-create-extension` options to include or exclude the `CREATE EXTENSION pgtap` statement in the generated test files. - - Fixed a bug taht threw an error when no database connection options + - Fixed a bug that threw an error when no database connection options were specified. - - Added support for the $PGPASSWORD environment variable. + - Added support for the `$PGPASSWORD` environment variable. - The emitted test scripts now include an appropriate plan that counts assertions, rather than `no_plan`, thanks to @slaught. - Added a number of additional tests to the emitted tests scripts, diff --git a/META.json b/META.json index f5d0170..7fbe973 100644 --- a/META.json +++ b/META.json @@ -4,7 +4,7 @@ "David E. Wheeler <dwhee...@cpan.org>" ], "dynamic_config" : 1, - "generated_by" : "Module::Build version 0.4212", + "generated_by" : "Module::Build version 0.4218", "license" : [ "perl_5" ], @@ -39,7 +39,7 @@ "provides" : { "TAP::Parser::SourceHandler::pgTAP" : { "file" : "lib/TAP/Parser/SourceHandler/pgTAP.pm", - "version" : "3.32" + "version" : "3.33" } }, "release_status" : "stable", @@ -55,5 +55,5 @@ "url" : "https://github.com/theory/tap-parser-sourcehandler-pgtap" } }, - "version" : "3.32" + "version" : "3.33" } diff --git a/META.yml b/META.yml index 2577d3a..3285275 100644 --- a/META.yml +++ b/META.yml @@ -8,7 +8,7 @@ build_requires: configure_requires: Module::Build: '0.30' dynamic_config: 1 -generated_by: 'Module::Build version 0.4212, CPAN::Meta::Converter version 2.150001' +generated_by: 'Module::Build version 0.4218, CPAN::Meta::Converter version 2.150001' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -17,7 +17,7 @@ name: TAP-Parser-SourceHandler-pgTAP provides: TAP::Parser::SourceHandler::pgTAP: file: lib/TAP/Parser/SourceHandler/pgTAP.pm - version: '3.32' + version: '3.33' recommends: Test::Pod: '1.41' Test::Pod::Coverage: '1.06' @@ -29,4 +29,4 @@ resources: homepage: https://search.cpan.org/dist/Tap-Parser-Sourcehandler-pgTAP/ license: http://dev.perl.org/licenses/ repository: https://github.com/theory/tap-parser-sourcehandler-pgtap -version: '3.32' +version: '3.33' diff --git a/README b/README index a6d2476..951ef50 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -TAP/Parser/SourceHandler/pgTAP version 3.32 +TAP/Parser/SourceHandler/pgTAP version 3.33 =========================================== This module adds support for executing [pgTAP](http://pgtap.org/) PostgreSQL diff --git a/bin/pg_prove b/bin/pg_prove index fed0c04..5e20585 100755 --- a/bin/pg_prove +++ b/bin/pg_prove @@ -4,7 +4,7 @@ use strict; use App::Prove; use Getopt::Long; -our $VERSION = '3.32'; +our $VERSION = '3.33'; $|++; # Fire up the app, process args, and run the tests. diff --git a/bin/pg_tapgen b/bin/pg_tapgen index a016dc8..edc6717 100755 --- a/bin/pg_tapgen +++ b/bin/pg_tapgen @@ -6,7 +6,7 @@ use DBI; use DBD::Pg; use Getopt::Long; use File::Spec; -our $VERSION = '3.32'; +our $VERSION = '3.33'; Getopt::Long::Configure (qw(bundling)); @@ -37,7 +37,7 @@ if ( $opts->{help} or $opts->{man} ) { } if ($opts->{version}) { - print 'pg_prove ', main->VERSION, $/; + print 'pg_prove ', main->VERSION, "\n"; exit; } @@ -100,6 +100,8 @@ script { materialized_views_are($schema); sequences_are($schema); functions_are($schema); + enums_are($schema); + extensions_are($schema); } } } 'schema.sql'; @@ -270,6 +272,48 @@ sub functions_are { # } } +sub enums_are { + my $schema = shift; + my $enums = $dbh->selectall_arrayref(q{ + SELECT e.oid, e.typname + FROM pg_catalog.pg_type e + JOIN pg_catalog.pg_namespace n ON n.oid = e.typnamespace + WHERE e.typtype = 'e' + AND n.nspname = ? + }, undef, $schema); + return unless $enums && @{ $enums }; + print "SELECT enums_are('$schema', ARRAY[\n '", + join("',\n '", map { $_->[1] } @{ $enums }), + "'\n]);\n\n"; + $total_tests++; + + for my $enum (@{ $enums }) { + my $labels = enum_labels($enum->[0]); + print "SELECT enum_has_labels('$schema','$enum->[1]', ARRAY['", + join("','", map { $_->[0] } @{ $labels }), + "']);\n"; + $total_tests++; + } + print "\n"; +} + +sub extensions_are { + my $schema = shift; + my $extensions = $dbh->selectall_arrayref(q{ + SELECT e.oid, e.extname, e.extversion + FROM pg_catalog.pg_extension e + JOIN pg_catalog.pg_namespace n ON n.oid = e.extnamespace + WHERE n.nspname = ? + }, undef, $schema); + return unless $extensions && @{ $extensions }; + print "SELECT extensions_are('$schema', ARRAY[\n '", + join("',\n '", map { $_->[1] } @{ $extensions }), + "'\n]);\n"; + $total_tests++; + + print "\n"; +} + sub has_foreign_table { my ($schema, $table) = @_; print "SELECT has_foreign_table( @@ -290,6 +334,7 @@ sub has_table { $total_tests++; has_pk($schema, $table); columns_are($schema, $table); + triggers_are($schema, $table); } sub has_pk { @@ -344,15 +389,44 @@ sub columns_are { print "SELECT has_column( '$schema', '$table', '$col->[0]', '$desc should exist');\n", "SELECT col_type_is( '$schema', '$table', '$col->[0]', '$col->[1]', '$desc should be type $col->[1]');\n", "SELECT $null_fn '$schema', '$table', '$col->[0]', '$desc should $null_desc');\n", - "SELECT $def_fn'$schema', '$table', '$col->[0]', '$desc should${def_desc}have a default');\n"; + "SELECT $def_fn'$schema', '$table', '$col->[0]', '$desc should${def_desc} have a default');\n"; $total_tests = $total_tests + 4; if ($col->[3]) { print "SELECT col_default_is( '$schema', '$table', '$col->[0]', $col->[4], '$desc default is');\n"; $total_tests++ ; } - print $/; + print "\n"; + } + +} + +sub triggers_are { + my ($schema, $table) = @_; + my $triggers = $dbh->selectall_arrayref(q{ + SELECT t.tgname, ni.nspname, p.proname + FROM pg_catalog.pg_trigger t + JOIN pg_catalog.pg_class ct ON ct.oid = t.tgrelid + JOIN pg_catalog.pg_namespace nt ON nt.oid = ct.relnamespace + JOIN pg_catalog.pg_proc p ON p.oid = t.tgfoid + JOIN pg_catalog.pg_namespace ni ON ni.oid = p.pronamespace + WHERE nt.nspname = ? + AND ct.relname = ? + AND NOT t.tgisinternal + }, undef, $schema, $table); + + return unless $triggers && @{ $triggers }; + print "SELECT triggers_are('$schema', '$table', ARRAY[\n '", + join("',\n '", map { $_->[0] } @{ $triggers }), + "'\n]);\n\n"; + $total_tests++; + + for my $trigger (@{ $triggers }) { + print "SELECT has_trigger( '$schema', '$table', '$trigger->[0]'::name);\n", + "SELECT trigger_is( '$schema', '$table', '$trigger->[0]', '$trigger->[1]', '$trigger->[2]');\n"; + $total_tests = $total_tests + 2; } + print "\n"; } sub _hasc { @@ -392,6 +466,17 @@ sub function_owner { return $dbh->selectcol_arrayref($sth, undef, @_)->[0]; } +sub enum_labels { + my $sth = $dbh->prepare_cached(q{ + SELECT enumlabel + FROM pg_catalog.pg_enum + WHERE enumtypid = ? + ORDER BY enumsortorder + }); + return $dbh->selectall_arrayref($sth, undef, @_); +} + + __END__ =encoding utf8 diff --git a/lib/TAP/Parser/SourceHandler/pgTAP.pm b/lib/TAP/Parser/SourceHandler/pgTAP.pm index 692cdbe..9e98ae6 100644 --- a/lib/TAP/Parser/SourceHandler/pgTAP.pm +++ b/lib/TAP/Parser/SourceHandler/pgTAP.pm @@ -9,7 +9,7 @@ use TAP::Parser::Iterator::Process (); @ISA = qw(TAP::Parser::SourceHandler); TAP::Parser::IteratorFactory->register_handler(__PACKAGE__); -our $VERSION = '3.32'; +our $VERSION = '3.33'; =head1 Name @@ -309,7 +309,7 @@ sub make_iterator { --no-psqlrc --no-align --quiet - --pset pager= + --pset pager=off --pset tuples_only=true --set ON_ERROR_STOP=1 ); diff --git a/t/source_handler.t b/t/source_handler.t index a1a0dc5..b9e397e 100644 --- a/t/source_handler.t +++ b/t/source_handler.t @@ -25,7 +25,7 @@ $dir = catdir curdir, 't', 'bin' unless -d $dir; --no-psqlrc --no-align --quiet - --pset pager= + --pset pager=off --pset tuples_only=true --set ON_ERROR_STOP=1 ); -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libtap-parser-sourcehandler-pgtap-perl.git _______________________________________________ Pkg-perl-cvs-commits mailing list Pkg-perl-cvs-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits