summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Sabino Mullane2009-07-13 15:09:58 +0000
committerGreg Sabino Mullane2009-07-13 15:09:58 +0000
commit8b7a4636c7bcb51de4f69ec258f4c0bac4173a8b (patch)
treea2e2b7c412f472b1fefead2d0781cb262992514b
parentfd50323a6896478c95dec275b9673cd2223273ae (diff)
Add new test to make sure I update all the version numbers
-rw-r--r--MANIFEST.SKIP1
-rw-r--r--t/00_release.t84
2 files changed, 85 insertions, 0 deletions
diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP
index ad859c22d..728094e8c 100644
--- a/MANIFEST.SKIP
+++ b/MANIFEST.SKIP
@@ -11,3 +11,4 @@ test_database_check_postgres*
\.git/*
\.tmp$
set_translations.pl
+t/00_release.t
diff --git a/t/00_release.t b/t/00_release.t
new file mode 100644
index 000000000..28560c471
--- /dev/null
+++ b/t/00_release.t
@@ -0,0 +1,84 @@
+#!perl
+
+## Make sure the version number is consistent in all places
+
+use 5.006;
+use strict;
+use warnings;
+use Data::Dumper;
+use Test::More;
+use lib 't','.';
+
+if (!$ENV{TEST_AUTHOR}) {
+ plan skip_all => 'Set the environment variable TEST_AUTHOR to enable this test';
+}
+plan tests => 1;
+
+my %v;
+my $vre = qr{(\d+\.\d+\.\d+)};
+
+## Grab version from various files
+my $file = 'META.yml';
+open my $fh, '<', $file or die qq{Could not open "$file": $!\n};
+while (<$fh>) {
+ push @{$v{$file}} => [$1,$.] if /version\s*:\s*$vre/;
+}
+close $fh or warn qq{Could not close "$file": $!\n};
+
+$file = 'Makefile.PL';
+open $fh, '<', $file or die qq{Could not open "$file": $!\n};
+while (<$fh>) {
+ push @{$v{$file}} => [$1,$.] if /VERSION = '$vre'/;
+}
+close $fh or warn qq{Could not close "$file": $!\n};
+
+$file = 'check_postgres.pl';
+open $fh, '<', $file or die qq{Could not open "$file": $!\n};
+my $foundchange = 0;
+while (<$fh>) {
+ push @{$v{$file}} => [$1,$.] if (/VERSION = '$vre'/ or /check_postgres.pl version $vre/);
+ if (!$foundchange) {
+ if (/item B<Version $vre>/) {
+ push @{$v{$file}} => [$1,$.];
+ $foundchange=1;
+ }
+ }
+
+}
+close $fh or warn qq{Could not close "$file": $!\n};
+
+$file = 'check_postgres.pl.html';
+open $fh, '<', $file or die qq{Could not open "$file": $!\n};
+while (<$fh>) {
+ push @{$v{$file}} => [$1,$.] if /check_postgres.pl version $vre/;
+}
+close $fh or warn qq{Could not close "$file": $!\n};
+
+my $good = 1;
+my $lastver;
+for my $filename (keys %v) {
+ for my $glob (@{$v{$filename}}) {
+ my ($ver,$line) = @$glob;
+ if (! defined $lastver) {
+ $lastver = $ver;
+ }
+ elsif ($ver ne $lastver) {
+ $good = 0;
+ }
+ }
+}
+
+if ($good) {
+ pass "All version numbers are the same ($lastver)";
+}
+else {
+ fail "All version numbers were not the same!";
+ for my $filename (sort keys %v) {
+ for my $glob (@{$v{$filename}}) {
+ my ($ver,$line) = @$glob;
+ diag "File: $filename. Line: $line. Version: $ver\n";
+ }
+ }
+}
+
+exit;