Fetching contributors…
Cannot retrieve contributors at this time
387 lines (370 sloc) 19.8 KB
Revision history for pgTAP
* Fixed broken Perl detection in `Makefile`.
* Copied OS detection from Perl's `Configure` script to new script,
``. OS detection should now be much more accurate.
* Fixed `pg_prove` to exit with non-zero status if tests failed, as it works
better in automated testing environments and consistent with `prove` (fix by
Darrell Fuhriman).
* Updated documentation of supported environment variables in `bin/pg_prove`.
* Fixed a bug in the function tests where the return value of a function was
not always consistently formatted. For example, `function_returns()` would
find "bool" instead of "boolean".
* Added `isa_ok()`.
* Added support for building against 8.5 [Dan Colish].
* Added `pg_tapgen`, which is a start and automating pgTAP schema validation
0.22 2009-07-31T00:26:16
* Fixed failing test on 8.4rc2.
* Added result set testing functions. These allow testers to write queries in
pure SQL and check that their results are as expected. The new functions
+ `results_eq()`
+ `results_ne()`
+ `set_eq()`
+ `bag_eq()`
+ `set_ne()`
+ `bag_ne()`
+ `set_has()`
+ `bag_has()`
+ `set_hasnt()`
+ `bag_hasnt()`
* Changed some internal queries to use explicit `JOIN`s.
* Fixed capitalization of `TAP::Harness` in the `Makefile`. Thanks to
Quinn Weaver.
* Fixed a syntax error that caused `uninstall_pgtap.sql` to fail on older
PostgreSQL versions (fix by Quinn Weaver).
* Modified the summary documentation for the `--schema` and `--match` options
to `pg_prove` to better reflect that they are for finding xUnit tests,
not for finding pgTAP functions.
0.21 2009-05-29T00:04:31
* Fixed a bug in the processing of the `--schema` and `--match` options that
only shows up in Getopt::Long 2.38 or higher.
* A few doc and test typos fixed thanks to Gabrielle Roth.
* Fixed failing test on Solaris 10 on Intel thanks to Gabrielle Roth.
* Fixed a failing test for the version number string on 8.4 beta.
* Added `performs_ok()`.
* Added `has_language()`, `hasnt_language()`, and `language_is_trusted()`.
* Added `has_opclass()` and `hasnt_opclass()`.
* Added `has_rule()`, `hasnt_rule()`, `rule_is_instead()`, and `rule_is_on()`.
* Added `tablespaces_are()`, `schemas_are()`, `tables_are()`, `views_are()`,
`sequences_are()`, `functions_are()`, `indexes_are()`, `users_are()`,
`groups_are()`, `opclasses_are()`, `languages_are()`, and `rules_are()`.
* Added a `has_trigger(table, trigger, description)`. Note that this means
that if you were previously using `has_trigger(schema, table, trigger)`, you
will need to cast the third argument to `NAME` to get it working again.
* Changed `can_ok()` to `has_function()`, so that it's named like all of the
other functions that check for the presence of database objects. The old
`can_ok()` function is still available as an alias, but it emits a warning
and will be removed in a future version of pgTAP.
* Added `hasnt_trigger()`, `hasnt_index()`, and `hasnt_function()`.
* Added `function_lang_is()`, `function_returns()`, `is_definer()`,
`is_aggregate()`, `is_strict()`, and `volatility_is()`.
0.20 2009-03-29T19:05:40
* Changed the names of the functions tested in `sql/do_tap.sql` and
`sql/runtests.sql` so that they are less likely to be ordered differently
given varying collation orders provided in different locales and by
different vendors. Reported by Ingmar Brouns.
* Added the `--formatter` and `--archive` options to `pg_prove`.
* Fixed the typos in `pg_prove` where the output of `--help` listed
`--test-match` and `--test-schema` instead of `--match` and `--schema`.
* Added `has_cast()`, `hasnt_cast()`, and `cast_context_is()`.
* Fixed a borked function signature in `has_trigger()`.
* Added `has_operator()`, `has_leftop()`, and `has_rightop()`.
* Fixed a bug where the order of columns found for multicolumn indexes by
`has_index()` could be wrong. Reported by Jeff Wartes. Thanks to Andrew
Gierth for help fixing the query.
0.19 2009-02-21T02:09:26
* Added an alternate version of `col_default_is()` to better handle the common
case when a default is specified as a string, such as a text or expression
default. This means that you have to do a lot less casting of default values
specified in the arguments to `col_default_is()`. It also restores the
signature that 0.17 recommended be dropped.
* Added `has_role()` and `isnt_role()`.
* Added `has_user()`, `isnt_user()`, `is_superuser()`, and `isnt_superuser()`.
* Added `has_group()`, `isnt_group()`, and `is_member_of()`.
* Fixed syntax in the `Makefile` to make it compatible with older versions of
`make`. Reported by Aaron Kangas.
* Improved the documentation of `runtests()` to make it clearer that all tests
it runs are run in transactions that are rolled back after each test.
Suggested by Aaron Kangas.
* Added the `--runtests`, `--schema`, and `--match` options to `pg_prove` so
that it can be used to run xUnit-style test functions without an SQL script.
* Fixed a bug in `can()` where it could sometimes report that functions
were available in a schema when in fact they were not.
* In the schema testing functions, removed the use of `quote_ident()` to
compare all identifiers, such as table names, schema names, column names,
etc, added in 0.17. This is because `quote_ident(a) = quote_ident(b)` can't
give a different result than `a = b`, and besides, made things slower and
prevented the use of indexes. Thanks to Andrew Gierth for the spot.
* The output from `pg_prove` now includes a list of failing tests when it is
not run with `--verbose`. When using TAP::Harness 3.17 and later, it also
shows comments and diagnostics in the non-verbose output. Verbose output
still outputs everything.
0.18 2009-02-06T20:06:00
* Fixed `pg_version_num()`. It was broken in 0.16; sorry about that!
* Fixed a bug in `col_type_is()` where it would die if it was looking
for a type in a table that had dropped columns. Thanks to depesz and
RhodiumToad on #postgresql for the help nailing that one down!
* Fixed a test failure in `sql/coltap.sql` on PostgreSQL 8.3.
* Fixed a bug in the `Makefile` where it did not properly point to
`pg_config` when building from the `compat` directory in the
PostgreSQL source tree.
* Fixed a bug in the `Makefile` where the `test_setup.sql` file, which
is required for tests, was not always getting created.
0.17 2009-02-06T17:51:52
* Fixed `col_default_is()` so that it works properly in cases where the
default value is `NULL`.
* Fixed `col_default_is()` to gracefully handle different data types,
columns without defaults, and nonexistent columns.
* Fixed the three-argument form of `col_default_is()` to accept any data type
for the default, not just text. *NOTE:* You must `DROP FUNCTION
col_default_is ( NAME, NAME, TEXT );` if you have previous versions of this
function installed, so as to eliminate the incompatible version.
* Added `col_has_default()` and `col_hasnt_default()`.
* Changed default descriptions for column testing functions to refer to
the columns as the more SQL-standard `schema.table.column` instead of
* Modified all diagnostic messages and test descriptions that reference
database objects to use `quote_ident()` to quote the names of those
objects, rather than emitting them with or without double-quotes in an
ad-hoc way as had hitherto been the case.
* Modified `col_not_null()`, `col_is_null()` and `col_type_is()` to emit
diagnostics if they fail because the column in question does not
* Added `has_tablespace()` and `hasnt_tablespace()`.
* Added `has_sequence()` and `hasnt_sequence()`.
* Changed `has_index()` so that expressions are compared case-
* In the schema testing functions, now using `quote_ident()` to compare
all identifiers, such as table names, schema names, column names, etc.
It had been a mix of straight-forward string comparison, and
case-insensitive matching. This means that tests should use only
lowercase strings to specify object names, unless mixed case objects
were created with double quote characters.
* Added version of `todo()` with the `why` and `how_many` arguments
reversed, so that I don't have to remember a specific order.
0.16 2009-02-03T17:37:03
* Switched from a crazy trinary logic in `is()` and `isnt()` to the use
* Fixed documentation for the short version of `--help` in `pg_prove`.
It's `-H`, not `-h`.
* Fixed a bug in the makefile that prevented OS detection from working
properly on many platforms (including Linux, and probably many
others). This allows `os_name()` to actually work on those platforms.
* The definition of the `pg_typeof()` function is removed when
installing on PostgreSQL 8.4 and no C code is compiled, since the only
C code is for this function. This is because `pg_typeof()` is included
with PostgreSQL 8.4.
* Added `has_schema()` and `hasnt_schema()`.
* Added `has_type()`, `hasnt_type()`, `has_domain()`, `hasnt_domain()`,
`has_enum()`, and `hasnt_enum()`.
* Added `enum_has_labels()`.
* Updated the `Makefile` to fix the shebang line in `pg_prove` if
Perl is found, and to emit a warning if the `$PERL` variable is not
set. - Updated the `Makefile` so that if `$PERL` is set and
TAP::Harness is not installed, it warns the user to install it in
order to use `pg_prove`. - Updated the `Makefile` to set the location
of the `psql` binary to the bin directory specified for PostgreSQL
when it was built.
* Fixed `pg_version_num()` to work on PostgreSQL 8.4devel.
* Fixed test failures on PostgreSQL 8.4devel.
0.15 2009-01-20T18:41:24
* Changed `pg_typeof()` from immutable to stable, in compliance with its
configuration in the forthcoming PostgreSQL 8.4.
* Added `do_tap()`, which finds test functions and runs them, allowing
tap tests to be embedded in functions and then executed all at once.
* Added `runtests()`, which introduces xUnit-style test running, for
those who prefer to put their tests in a slew of test functions and
then run one function to run all of the test functions (plus startup,
setup, teardown, and shutdown tests).
* Added `findfuncs()`, which is used by `do_tap()` to find the functions
to execute.
* The `col_type_is()` function now requires that the type be visible in
the search path when it is called without a schema argument.
* The `plan()` function no longer resets the `client_min_messages`
setting to its default value, but leaves it set to whatever it was set
to before the function was called.
* Fixed a typo in the documentation of the short version of the
`--version` option to `pg_prove`, which is `-V`, not `-v`.
* Added `pgtap_version()`.
* Added the "html" make target to generate the HTML documentation for
the Web site, including a table of contents and documentation for
0.14 2008-10-27T22:43:36
* Added `SET search_path` statements to `` so that
it will work properly when TAP is installed in its own schema. Thanks to
Ben for the catch!
* Added commands to drop `pg_version()` and `pg_version_num()`
* Added `has_index()`, `index_is_unique()`, `index_is_primary()`,
`is_clustered()`, and `index_is_type()`.
* Added `os_name()`. This is somewhat experimental. If you have `uname`,
it's probably correct, but assistance in improving OS detection in the
`Makefile` would be greatly appreciated. Notably, it does not detect
* Made `ok()` smarter when the test result is passed as `NULL`. It was
dying, but now it simply fails and attaches a diagnostic message
reporting that the test result was `NULL`. Reported by Jason Gordon.
* Fixed an issue in `check_test()` where an extra character was removed
from the beginning of the diagnostic output before testing it.
* Fixed a bug comparing `name[]`s on PostgreSQL 8.2, previously hacked
* Added `has_trigger()` and `trigger_is()`.
* Switched to pure SQL implementations of the `pg_version()` and
`pg_version_num()` functions, to simplify including pgTAP in module
* Added a note to `README.pgtap` about the need to avoid `pg_typeof()`
and `cmp_ok()` in tests run as part of a distribution.
0.13 2008-10-13T19:09:46
* Added `pg_version()` and `pg_version_num()`.
* Documented `pg_typeof()`.
0.12 2008-10-11T04:02:42
* Updated `plan()` to disable warnings while it creates its tables.
This means that `plan()` no longer send NOTICE messages when they run,
although tests still might, depending on the setting of
* Added `hasnt_table()`, `hasnt_view()`, and `hasnt_column()`.
* Added `hasnt_pk()`, `hasnt_fk()`, `col_isnt_pk()`, and
* Added missing `DROP` statements to ``.
0.11 2008-09-24T20:41:42
* Simplified the tests so that they now load `test_setup.sql` instead of
setting a bunch of stuff themselves. Now only `test_setup.sql` needs
to be created from ``, and the other `.sql` files
depend on it, meaning that one no longer has to specify `TAPSCHEMA`
for any `make` target other than the default.
* Eliminated all uses of `E''` in the tests, so that we don't have to
process them for testing on 8.0.
* Fixed the spelling of `ON_ROLLBACK` in the test setup. Can't believe I
had it with one L in all of the test files before! Thanks to Curtis
"Ovid" Poe for the spot.
* Added a couple of variants of `todo()` and `skip()`, since I can never
remember whether the numeric argument comes first or second. Thanks to
PostgreSQL's functional polymorphism, I don't have to. Also, there are
variants where the numeric value, if not passed, defaults to 1.
* Updated the link to the pgTAP home page in ``.
* TODO tests can now nest.
* Added `todo_start()`, `todo_end()`, and `in_todo()`.
* Added variants of `throws_ok()` that test error messages as well as
error codes.
* Converted some more tests to use `check_test()`.
* Added `can()` and `can_ok()`.
* Fixed a bug in `check_test()` where the leading white space for
diagnostic messages could be off by 1 or more characters.
* Fixed the `installcheck` target so that it properly installs PL/pgSQL
into the target database before the tests run.
0.10 2008-09-18T22:59:31
* Changed `pg_prove` to set `QUIET=1` when it runs, so as to prevent the
output of extraneous stuff.
* Added some `GRANT` statements to `plan()` in order to make it easier
to run tests using roles other than the one that called `plan()`.
Patch from Rod Taylor.
* Replaced a call to `lastval()` with a call to `currval()` in order to
improve compatibility with PostgreSQL 8.0. Reported by David Westbrook.
* Added support for TODO and SKIP tests.
* Removed the few uses of named parameters and added alias names instead.
This improves compatibility for versions of PostgreSQL prior to 8.0.
Reported by David Westbrook.
* Fixed the plural of "test" in the output from `finish()`. It was
plural when there was one test and singular otherwise. So I reversed
* Moved assignment to declared variables from the `DECLARE` block to the
body of the functions. Improves compatibility with versions of
PostgreSQL prior to 8.0. Reported by David Westbrook.
* Eliminated passing the result of a function call to `RAISE` in order
to better support older versions of PostgreSQL. Reported by David
* Switched from using `FOUND` to `GET DIAGNOSTICS ROW_COUNT` because the
former does not seem to be set for `EXECUTE` SQL in older versions of
PostgreSQL. Reported by David Westbrook.
* Added tests specifically targeting PostgreSQL 7.3. From David
* Ported all the way back to PostgreSQL 8.0, thanks to some Makefile
hackery and a patch file. All tests pass on 8.0, 8.1, 8.2, and 8.3.
The only exception is `throws_ok()` and `lives_ok()`, which are not
supported on 8.0. Versions of PostgreSQL lower than 8.0 are not yet
supported, even though we have made some changes to simplify getting
things to work in earlier versions.
* Changed "got/expected" to "have/want", following Schwern's plans for
Test::Builder 2. Also changed "caught/expected" to "caught/wanted" for
nice parity when outputting diagnostics for exception testing.
* Added the `has_table()`, `has_view()`, `has_column()`, `has_pk()`,
`has_fk()`, `fk_ok()`, `has_unique()` and `has_check()` test
* Added the `col_not_null()` and `col_is_null()` test functions.
* Added the `col_type_is()`, `col_default_is()`, `col_is_pk()`,
`col_is_fk()`, `col_is_unique()`, and `col_has_check()` test
* Fixed `is()` and `isnt()` to better handle `NULL`s.
* Added `cmp_ok()`.
* Added the `--set ON_ERROR_STOP=1` option to the call to `psql` in
* Renamed `` to ``, which is more
in line with typical PostgreSQL contrib modules.
* Removed verbose output of the `psql` command from `pg_prove`. Thanks
to Andy Armstrong for the spot.
* Divided the tests up into many separate test script files, so that
things are a bit better organized and easier to maintain.
* Added the `check_test()` function and started converting internal
tests to use it instead of the hacked stuff they were doing before.
* As in Test::Builder 0.81_01, changed the message for extra tests run
to show the number of tests run rather than the number extra to avoid
the user having to do mental math.
* The regression test files are now processed by `make installcheck` and
`make test` so that the schema can be properly set, if pgTAP is built
with a schema.
0.02 2008-06-17T16:26:41
* Converted the documentation to Markdown.
* Added pg_prove, a Perl script that use TAP::Harness to run tests and
report the results, just like the Perl program `prove`.
* Fixed `no_plan()` so that it no longer emits a plan, which apparently
was wrong. Now `finish()` outputs it when there's no plan.
* Fixed the test script so that it now emits a proper plan.
* Removed all of the configuration settings from `pgtap.sql`, as they're
now handled by `pg_prove`. I've mentioned them in the README for
* Added `lives_ok()`.
* Moved the creation of temporary tables into `plan()`, so that
everything is properly self-contained.
* Improved the handling of transactions. Test scripts are now assumed to
be single transactions with a ROLLBACK at the end. This makes it so
that test scripts don't have to include `drop_pgtap.sql`.
* Updated `pg_prove` to rollback on an error, rather than just stop.
This allows all test functions to be properly rolled back, too, in a
test script that includes them but then encounters an unhandled
* Updated `pg_prove` to emit an appropriate error message if no test
scripts are specified.
* Added a Makefile. It uses the typical PostgreSQL installation
procedures to install pgTAP. The SQL files have now been turned into
`.in` templates that are processed by `make`.
* Added support for schema qualification of test functions. Just set the
`$TAPSCHEMA` environment variable when running `make`.
* Added support for standard PostgreSQL-type regression testing by just
copying the test script, setting some variables inside it, and
providing an `expected/` directory. The test now lives in the `sql/`
* Changed all instances of `RETURN QUERY SELECT` to `RETURN NEXT`, which
should allow pgtap to run on versions of PostgreSQL earlier than 8.3.
Thanks to Neil Conway for the suggestion.
0.01 2008-06-07T05:24:27
* Initial public release. Announcement at