File: 00_test_tester.t

package info (click to toggle)
check-postgres 2.26.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 2,032 kB
  • sloc: perl: 12,710; sh: 19; makefile: 13
file content (55 lines) | stat: -rw-r--r-- 1,058 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!perl

## Make sure we have tests for all actions

use 5.008;
use strict;
use warnings;
use Data::Dumper;
use Test::More;
use lib 't','.';
use CP_Testing;

if (!$ENV{RELEASE_TESTING}) {
    plan (skip_all =>  'Test skipped unless environment variable RELEASE_TESTING is set');
}

plan tests => 1;

use vars qw/$dbh $SQL $t $info/;

my $cp = CP_Testing->new();

$dbh = $cp->test_database_handle();

$info = $cp->run('help','--help');

my %action;
for my $line (split /\n/ => $info) {
    next if $line !~ /^ (\w+) +\- [A-Z]/;
    $action{$1}++;
}

my $ok = 1;
for my $act (sort keys %action) {
    ## Special known exceptions
    next if grep { $act eq $_ } qw(
        index_size table_size indexes_size total_relation_size
        last_autoanalyze last_autovacuum
    );

    my $file = "t/02_$act.t";
    if (! -e $file) {
        diag qq{No matching test file found for action "$act" (expected $file)\n};
        $ok = 0;
    }
}

if ($ok) {
    pass 'There is a test for every action';
}
else {
    fail 'Did not find a test for every action';
}

exit;