]> git.imager.perl.org - imager.git/blob - t/x90cmpversion.t
ddaa88a350d00dcb5dd10e648625fdcc6663d4db
[imager.git] / t / x90cmpversion.t
1 #!perl -w
2 use strict;
3 use Test::More;
4 use ExtUtils::MakeMaker;
5 use File::Spec::Functions qw(devnull);
6
7 my $last_tag = `git describe --abbrev=0`;
8 chomp $last_tag;
9
10 $last_tag
11   or plan skip_all => "Only usable in a git checkout";
12
13 my @subdirs = qw(PNG TIFF GIF JPEG W32 T1 FT2);
14
15 plan tests => scalar(@subdirs);
16
17 for my $dir (@subdirs) {
18   my @changes = `git log --abbrev --oneline $last_tag..HEAD $dir`;
19  SKIP:
20   {
21     @changes or skip "No changes for $dir", 1;
22     my $vfile = "$dir/$dir.pm";
23     my $current = eval { MM->parse_version($vfile) };
24     my $last_rel_content = get_file_from_git($vfile, $last_tag);
25     my $last = eval { MM->parse_version(\$last_rel_content) };
26     isnt($current, $last, "$dir updated, $vfile version bump");
27   }
28 }
29
30 sub get_file_from_git {
31     my ($file, $tag) = @_;
32     my $null = devnull();
33     local $/;
34     return scalar `git --no-pager show $tag:$file 2>$null`;
35 }