1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-18 17:42:25 +03:00

Use $Test::Builder::Level in TAP test functions

In TAP test functions, that is, those that produce test results, locally
increment $Test::Builder::Level.  This has the effect that test failures
are reported at the callers location rather than somewhere in the test
support libraries.

Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
This commit is contained in:
Peter Eisentraut
2018-05-22 14:25:01 -04:00
parent 65782346a4
commit c4309f4aee
4 changed files with 27 additions and 0 deletions

View File

@ -1366,6 +1366,8 @@ PostgresNode.
sub command_ok
{
local $Test::Builder::Level = $Test::Builder::Level + 1;
my $self = shift;
local $ENV{PGPORT} = $self->port;
@ -1384,6 +1386,8 @@ TestLib::command_fails with our PGPORT. See command_ok(...)
sub command_fails
{
local $Test::Builder::Level = $Test::Builder::Level + 1;
my $self = shift;
local $ENV{PGPORT} = $self->port;
@ -1402,6 +1406,8 @@ TestLib::command_like with our PGPORT. See command_ok(...)
sub command_like
{
local $Test::Builder::Level = $Test::Builder::Level + 1;
my $self = shift;
local $ENV{PGPORT} = $self->port;
@ -1420,6 +1426,8 @@ TestLib::command_checks_all with our PGPORT. See command_ok(...)
sub command_checks_all
{
local $Test::Builder::Level = $Test::Builder::Level + 1;
my $self = shift;
local $ENV{PGPORT} = $self->port;
@ -1442,6 +1450,8 @@ The log file is truncated prior to running the command, however.
sub issues_sql_like
{
local $Test::Builder::Level = $Test::Builder::Level + 1;
my ($self, $cmd, $expected_sql, $test_name) = @_;
local $ENV{PGPORT} = $self->port;