pgsql: Improve TAP tests by replacing ok() with better Test::More funct - Mailing list pgsql-committers

From Michael Paquier
Subject pgsql: Improve TAP tests by replacing ok() with better Test::More funct
Date
Msg-id E1v9dCf-00260y-1J@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Improve TAP tests by replacing ok() with better Test::More functions

The TAP tests whose ok() calls are changed in this commit were relying
on perl operators, rather than equivalents available in Test::More.  For
example, rather than the following:
ok($data =~ qr/expr/m, "expr matching");
ok($data !~ qr/expr/m, "expr not matching");
The new test code uses this equivalent:
like($data, qr/expr/m, "expr matching");
unlike($data, qr/expr/m, "expr not matching");

A huge benefit of the new formulation is that it is possible to know
about the values we are checking if a failure happens, making debugging
easier, should the test runs happen in the buildfarm, in the CI or
locally.

This change leads to more test code overall as perltidy likes to make
the code pretty the way it is in this commit.

Author: Sadhuprasad Patro <b.sadhu@gmail.com>
Discussion: https://postgr.es/m/CAFF0-CHhwNx_Cv2uy7tKjODUbeOgPrJpW4Rpf1jqB16_1bU2sg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/fabb33b351c2504a1985f9a1cdf697924cd5f023

Modified Files
--------------
contrib/amcheck/t/004_verify_nbtree_unique.pl      |  20 ++-
contrib/pg_visibility/t/002_corrupt_vm.pl          |   2 +-
src/bin/initdb/t/001_initdb.pl                     |   6 +-
src/bin/pg_basebackup/t/040_pg_createsubscriber.pl |   2 +-
src/bin/pg_combinebackup/t/010_hardlink.pl         |   4 +-
src/bin/pg_dump/t/002_pg_dump.pl                   |   6 +-
src/bin/pg_dump/t/005_pg_dump_filterfile.pl        | 135 +++++++++++++--------
src/bin/pgbench/t/001_pgbench_with_server.pl       |  33 +++--
src/bin/psql/t/001_basic.pl                        |   2 +-
src/bin/scripts/t/020_createdb.pl                  |   4 +-
.../libpq/t/003_load_balance_host_list.pl          |  11 +-
src/interfaces/libpq/t/004_load_balance_dns.pl     |  11 +-
src/test/modules/test_aio/t/002_io_workers.pl      |   5 +-
.../test_misc/t/001_constraint_validation.pl       | 123 +++++++++++--------
src/test/modules/test_misc/t/002_tablespace.pl     |  40 +++---
src/test/modules/test_pg_dump/t/001_base.pl        |   6 +-
src/test/modules/xid_wraparound/t/002_limits.pl    |   2 +-
src/test/recovery/t/001_stream_rep.pl              |  18 +--
src/test/recovery/t/003_recovery_targets.pl        |   9 +-
src/test/recovery/t/005_replay_delay.pl            |   6 +-
src/test/recovery/t/006_logical_decoding.pl        |  11 +-
src/test/recovery/t/020_archive_status.pl          |   4 +-
src/test/recovery/t/024_archive_recovery.pl        |   5 +-
.../recovery/t/035_standby_logical_decoding.pl     |  15 ++-
.../recovery/t/040_standby_failover_slots_sync.pl  |  33 +++--
.../recovery/t/044_invalidate_inactive_slots.pl    |   4 +-
src/test/subscription/t/001_rep_changes.pl         |  24 ++--
src/test/subscription/t/007_ddl.pl                 |  15 ++-
src/test/subscription/t/013_partition.pl           |  35 +++---
src/test/subscription/t/027_nosuperuser.pl         |   5 +-
src/test/subscription/t/031_column_list.pl         |   5 +-
src/test/subscription/t/035_conflicts.pl           |  47 ++++---
32 files changed, 393 insertions(+), 255 deletions(-)


pgsql-committers by date:

Previous
From: Fujii Masao
Date:
Subject: pgsql: doc: Clarify when backend_xmin in pg_stat_replication can be NUL
Next
From: Daniel Gustafsson
Date:
Subject: pgsql: Replace defunct URL with stable archive.org URL in rbtree.c