Re: Readd use of TAP subtests - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Readd use of TAP subtests
Date
Msg-id e8a8768c-81a6-2eca-db96-f6e741b4ffad@enterprisedb.com
Whole thread Raw
In response to Re: Readd use of TAP subtests  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
Responses Re: Readd use of TAP subtests
Re: Readd use of TAP subtests
List pgsql-hackers
Now that we have switched everything to done_testing(), the subtests 
feature isn't that relevant anymore, but it might still be useful to get 
better output when running with PROVE_FLAGS=--verbose.  Compare before:

t/001_basic.pl ..
1..8
ok 1 - vacuumlo --help exit code 0
ok 2 - vacuumlo --help goes to stdout
ok 3 - vacuumlo --help nothing to stderr
ok 4 - vacuumlo --version exit code 0
ok 5 - vacuumlo --version goes to stdout
ok 6 - vacuumlo --version nothing to stderr
ok 7 - vacuumlo with invalid option nonzero exit code
ok 8 - vacuumlo with invalid option prints error message
ok
All tests successful.
Files=1, Tests=8,  0 wallclock secs ( 0.02 usr  0.00 sys +  0.08 cusr 
0.05 csys =  0.15 CPU)
Result: PASS

After (with attached patch):

t/001_basic.pl ..
# Subtest: vacuumlo --help
     ok 1 - exit code 0
     ok 2 - goes to stdout
     ok 3 - nothing to stderr
     1..3
ok 1 - vacuumlo --help
# Subtest: vacuumlo --version
     ok 1 - exit code 0
     ok 2 - goes to stdout
     ok 3 - nothing to stderr
     1..3
ok 2 - vacuumlo --version
# Subtest: vacuumlo options handling
     ok 1 - invalid option nonzero exit code
     ok 2 - invalid option prints error message
     1..2
ok 3 - vacuumlo options handling
1..3
ok
All tests successful.
Files=1, Tests=3,  0 wallclock secs ( 0.02 usr  0.01 sys +  0.11 cusr 
0.07 csys =  0.21 CPU)
Result: PASS

I think for deeply nested tests and test routines defined in other 
modules, this helps structure the test output more like the test source 
code is laid out, so it makes following the tests and locating failing 
test code easier.
Attachment

pgsql-hackers by date:

Previous
From: Aleksander Alekseev
Date:
Subject: Re: PATCH: add "--config-file=" option to pg_rewind
Next
From: Amit Kapila
Date:
Subject: Re: Optionally automatically disable logical replication subscriptions on error