]> git.imager.perl.org - imager.git/blob - t/x90cmpversion.t
prefer static first
[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   my @more_changes = `git status --porcelain $dir`;
20  SKIP:
21   {
22     @changes || @more_changes
23       or skip "No changes for $dir", 1;
24     my $vfile = "$dir/$dir.pm";
25     my $current = eval { MM->parse_version($vfile) };
26     my $last_rel_content = get_file_from_git($vfile, $last_tag);
27     my $last = eval { MM->parse_version(\$last_rel_content) };
28     unless (isnt($current, $last, "$dir updated, $vfile version bump")) {
29       diag(@changes, @more_changes);
30     }
31   }
32 }
33
34 sub get_file_from_git {
35     my ($file, $tag) = @_;
36     my $null = devnull();
37     local $/;
38     return scalar `git --no-pager show $tag:$file 2>$null`;
39 }