From b1773c0b220b71ac486dfd4bfb2d7a95f623db32 Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Thu, 23 Apr 2009 13:24:48 -0400 Subject: [PATCH] Add a test to ensure test coverage of all actions. Rename walfiles.t to wal_files.t --- t/00_test_tester.t | 47 +++++++++++++++++++++++++++++ t/{02_walfiles.t => 02_wal_files.t} | 0 2 files changed, 47 insertions(+) create mode 100644 t/00_test_tester.t rename t/{02_walfiles.t => 02_wal_files.t} (100%) diff --git a/t/00_test_tester.t b/t/00_test_tester.t new file mode 100644 index 000000000..9ae0c5e4f --- /dev/null +++ b/t/00_test_tester.t @@ -0,0 +1,47 @@ +#!perl + +## Make sure we have tests for all actions + +use strict; +use warnings; +use Data::Dumper; +use DBI; +use Test::More tests => 1; +use lib 't','.'; +use CP_Testing; + +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 $act eq 'table_size' or $act eq 'index_size'; + next if $act eq 'last_autoanalyze' or $act eq '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\n"; +} +else { + fail "Did not find a test for every action\n"; +} + +exit; diff --git a/t/02_walfiles.t b/t/02_wal_files.t similarity index 100% rename from t/02_walfiles.t rename to t/02_wal_files.t -- 2.39.5