pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Improve TAP tests by replacing ok() with better Test::More funct
2+ messages / 2 participants
[nested] [flat]

* pgsql: Improve TAP tests by replacing ok() with better Test::More funct
@ 2025-10-17 05:40  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2025-10-17 05:40 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Improve TAP tests by replacing ok() with better Test::More funct
@ 2025-10-17 15:25  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2025-10-17 15:25 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Improve TAP tests by replacing ok() with better Test::More functions

Transpose the changes made by commit fabb33b35 in 002_pg_dump.pl
into its recently-created clone 006_pg_dump_compress.pl.

Branch
------
master

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

Modified Files
--------------
src/bin/pg_dump/t/006_pg_dump_compress.pl | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-10-17 15:25 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-10-17 05:40 pgsql: Improve TAP tests by replacing ok() with better Test::More funct Michael Paquier <michael@paquier.xyz>
2025-10-17 15:25 pgsql: Improve TAP tests by replacing ok() with better Test::More funct Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox