File: 982_git.t

package info (click to toggle)
libtest-regexp-perl 2016060501-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 224 kB
  • ctags: 30
  • sloc: perl: 1,320; makefile: 2
file content (40 lines) | stat: -rwxr-xr-x 778 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
#!/usr/bin/perl

use Test::More;

use strict;
use warnings;
no  warnings 'syntax';

unless ($ENV {AUTHOR_TESTING}) {
    plan skip_all => "AUTHOR tests";
    exit;
}

unless (-f ".git/config") {
    plan skip_all => "This is not a git repository";
    exit;
}

undef $ENV {PATH};
my ($GIT)  = grep {-x} qw [/opt/git/bin/git /opt/local/bin/git];
my ($HEAD) = grep {-x} qw [/usr/bin/head];

my @output = `$GIT status --porcelain`;

diag @output;
ok @output == 0, "All files are checked in";

my @tags = sort grep {/^release/} `$GIT tag`;

chomp (my $final_tag = $tags [-1]);

my $changes_line = `$HEAD -1 Changes`;

ok $final_tag    && 
   $changes_line &&
   $final_tag eq "release-" . ($changes_line =~ /^Version ([0-9]{10})/) [0],
   "git tag matches version";


done_testing;