Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ae3eb9b

Browse files
committed
Remove use of TAP subtests
They turned out to be too much of a portability headache, because they need a fairly new version of Test::More to work properly.
1 parent 22b3003 commit ae3eb9b

21 files changed

+45
-76
lines changed

src/bin/initdb/t/001_initdb.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use strict;
22
use warnings;
33
use TestLib;
4-
use Test::More tests => 14;
4+
use Test::More tests => 19;
55

66
my $tempdir = TestLib::tempdir;
77

src/bin/pg_basebackup/t/010_pg_basebackup.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
use warnings;
33
use Cwd;
44
use TestLib;
5-
use Test::More tests => 28;
5+
use Test::More tests => 33;
66

77
program_help_ok('pg_basebackup');
88
program_version_ok('pg_basebackup');

src/bin/pg_basebackup/t/020_pg_receivexlog.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use strict;
22
use warnings;
33
use TestLib;
4-
use Test::More tests => 3;
4+
use Test::More tests => 8;
55

66
program_help_ok('pg_receivexlog');
77
program_version_ok('pg_receivexlog');

src/bin/pg_config/t/001_pg_config.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use strict;
22
use warnings;
33
use TestLib;
4-
use Test::More tests => 7;
4+
use Test::More tests => 20;
55

66
program_help_ok('pg_config');
77
program_version_ok('pg_config');

src/bin/pg_controldata/t/001_pg_controldata.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use strict;
22
use warnings;
33
use TestLib;
4-
use Test::More tests => 6;
4+
use Test::More tests => 13;
55

66
my $tempdir = TestLib::tempdir;
77

src/bin/pg_ctl/t/001_start_stop.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use strict;
22
use warnings;
33
use TestLib;
4-
use Test::More tests => 10;
4+
use Test::More tests => 15;
55

66
my $tempdir = TestLib::tempdir;
77
my $tempdir_short = TestLib::tempdir_short;

src/bin/scripts/t/010_clusterdb.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use strict;
22
use warnings;
33
use TestLib;
4-
use Test::More tests => 6;
4+
use Test::More tests => 13;
55

66
program_help_ok('clusterdb');
77
program_version_ok('clusterdb');

src/bin/scripts/t/011_clusterdb_all.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use strict;
22
use warnings;
33
use TestLib;
4-
use Test::More tests => 1;
4+
use Test::More tests => 2;
55

66
my $tempdir = tempdir;
77
start_test_server $tempdir;

src/bin/scripts/t/020_createdb.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use strict;
22
use warnings;
33
use TestLib;
4-
use Test::More tests => 6;
4+
use Test::More tests => 13;
55

66
program_help_ok('createdb');
77
program_version_ok('createdb');

src/bin/scripts/t/030_createlang.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use strict;
22
use warnings;
33
use TestLib;
4-
use Test::More tests => 6;
4+
use Test::More tests => 14;
55

66
program_help_ok('createlang');
77
program_version_ok('createlang');

src/bin/scripts/t/040_createuser.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use strict;
22
use warnings;
33
use TestLib;
4-
use Test::More tests => 8;
4+
use Test::More tests => 17;
55

66
program_help_ok('createuser');
77
program_version_ok('createuser');

src/bin/scripts/t/050_dropdb.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use strict;
22
use warnings;
33
use TestLib;
4-
use Test::More tests => 5;
4+
use Test::More tests => 11;
55

66
program_help_ok('dropdb');
77
program_version_ok('dropdb');

src/bin/scripts/t/060_droplang.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use strict;
22
use warnings;
33
use TestLib;
4-
use Test::More tests => 5;
4+
use Test::More tests => 11;
55

66
program_help_ok('droplang');
77
program_version_ok('droplang');

src/bin/scripts/t/070_dropuser.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use strict;
22
use warnings;
33
use TestLib;
4-
use Test::More tests => 5;
4+
use Test::More tests => 11;
55

66
program_help_ok('dropuser');
77
program_version_ok('dropuser');

src/bin/scripts/t/080_pg_isready.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use strict;
22
use warnings;
33
use TestLib;
4-
use Test::More tests => 5;
4+
use Test::More tests => 10;
55

66
program_help_ok('pg_isready');
77
program_version_ok('pg_isready');

src/bin/scripts/t/090_reindexdb.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use strict;
22
use warnings;
33
use TestLib;
4-
use Test::More tests => 7;
4+
use Test::More tests => 16;
55

66
program_help_ok('reindexdb');
77
program_version_ok('reindexdb');

src/bin/scripts/t/091_reindexdb_all.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use strict;
22
use warnings;
33
use TestLib;
4-
use Test::More tests => 1;
4+
use Test::More tests => 2;
55

66
my $tempdir = tempdir;
77
start_test_server $tempdir;

src/bin/scripts/t/100_vacuumdb.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use strict;
22
use warnings;
33
use TestLib;
4-
use Test::More tests => 8;
4+
use Test::More tests => 18;
55

66
program_help_ok('vacuumdb');
77
program_version_ok('vacuumdb');

src/bin/scripts/t/101_vacuumdb_all.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use strict;
22
use warnings;
33
use TestLib;
4-
use Test::More tests => 1;
4+
use Test::More tests => 2;
55

66
my $tempdir = tempdir;
77
start_test_server $tempdir;

src/bin/scripts/t/102_vacuumdb_stages.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use strict;
22
use warnings;
33
use TestLib;
4-
use Test::More tests => 2;
4+
use Test::More tests => 4;
55

66
my $tempdir = tempdir;
77
start_test_server $tempdir;

src/test/perl/TestLib.pm

+25-56
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,6 @@ BEGIN
3737
{
3838
plan skip_all => "IPC::Run not available";
3939
};
40-
41-
eval {
42-
Test::More->VERSION('0.93_01');
43-
} or do
44-
{
45-
plan skip_all => "version of Test::More is too old to support subplans";
46-
};
47-
48-
eval {
49-
require Test::Simple;
50-
Test::Simple->VERSION('0.98');
51-
} or do
52-
{
53-
plan skip_all => "version of Test::Simple is too old to support subplans properly";
54-
};
5540
}
5641

5742
# Set to untranslated messages, to be able to compare program output
@@ -180,67 +165,51 @@ sub command_exit_is
180165
sub program_help_ok
181166
{
182167
my ($cmd) = @_;
183-
subtest "$cmd --help" => sub {
184-
plan tests => 3;
185-
my ($stdout, $stderr);
186-
my $result = run [ $cmd, '--help' ], '>', \$stdout, '2>', \$stderr;
187-
ok($result, "$cmd --help exit code 0");
188-
isnt($stdout, '', "$cmd --help goes to stdout");
189-
is($stderr, '', "$cmd --help nothing to stderr");
190-
};
168+
my ($stdout, $stderr);
169+
my $result = run [ $cmd, '--help' ], '>', \$stdout, '2>', \$stderr;
170+
ok($result, "$cmd --help exit code 0");
171+
isnt($stdout, '', "$cmd --help goes to stdout");
172+
is($stderr, '', "$cmd --help nothing to stderr");
191173
}
192174

193175
sub program_version_ok
194176
{
195177
my ($cmd) = @_;
196-
subtest "$cmd --version" => sub {
197-
plan tests => 3;
198-
my ($stdout, $stderr);
199-
my $result = run [ $cmd, '--version' ], '>', \$stdout, '2>', \$stderr;
200-
ok($result, "$cmd --version exit code 0");
201-
isnt($stdout, '', "$cmd --version goes to stdout");
202-
is($stderr, '', "$cmd --version nothing to stderr");
203-
};
178+
my ($stdout, $stderr);
179+
my $result = run [ $cmd, '--version' ], '>', \$stdout, '2>', \$stderr;
180+
ok($result, "$cmd --version exit code 0");
181+
isnt($stdout, '', "$cmd --version goes to stdout");
182+
is($stderr, '', "$cmd --version nothing to stderr");
204183
}
205184

206185
sub program_options_handling_ok
207186
{
208187
my ($cmd) = @_;
209-
subtest "$cmd options handling" => sub {
210-
plan tests => 2;
211-
my ($stdout, $stderr);
212-
my $result = run [ $cmd, '--not-a-valid-option' ], '>', \$stdout,
213-
'2>', \$stderr;
214-
ok(!$result, "$cmd with invalid option nonzero exit code");
215-
isnt($stderr, '', "$cmd with invalid option prints error message");
216-
};
188+
my ($stdout, $stderr);
189+
my $result = run [ $cmd, '--not-a-valid-option' ], '>', \$stdout, '2>', \$stderr;
190+
ok(!$result, "$cmd with invalid option nonzero exit code");
191+
isnt($stderr, '', "$cmd with invalid option prints error message");
217192
}
218193

219194
sub command_like
220195
{
221196
my ($cmd, $expected_stdout, $test_name) = @_;
222-
subtest $test_name => sub {
223-
plan tests => 3;
224-
my ($stdout, $stderr);
225-
my $result = run $cmd, '>', \$stdout, '2>', \$stderr;
226-
ok($result, "@$cmd exit code 0");
227-
is($stderr, '', "@$cmd no stderr");
228-
like($stdout, $expected_stdout, "$test_name: matches");
229-
};
197+
my ($stdout, $stderr);
198+
my $result = run $cmd, '>', \$stdout, '2>', \$stderr;
199+
ok($result, "@$cmd exit code 0");
200+
is($stderr, '', "@$cmd no stderr");
201+
like($stdout, $expected_stdout, "$test_name: matches");
230202
}
231203

232204
sub issues_sql_like
233205
{
234206
my ($cmd, $expected_sql, $test_name) = @_;
235-
subtest $test_name => sub {
236-
plan tests => 2;
237-
my ($stdout, $stderr);
238-
truncate $test_server_logfile, 0;
239-
my $result = run $cmd, '>', \$stdout, '2>', \$stderr;
240-
ok($result, "@$cmd exit code 0");
241-
my $log = `cat '$test_server_logfile'`;
242-
like($log, $expected_sql, "$test_name: SQL found in server log");
243-
};
207+
my ($stdout, $stderr);
208+
truncate $test_server_logfile, 0;
209+
my $result = run $cmd, '>', \$stdout, '2>', \$stderr;
210+
ok($result, "@$cmd exit code 0");
211+
my $log = `cat '$test_server_logfile'`;
212+
like($log, $expected_sql, "$test_name: SQL found in server log");
244213
}
245214

246215
1;

0 commit comments

Comments
 (0)