~ubuntu-branches/ubuntu/trusty/libsub-exporter-formethods-perl/trusty

« back to all changes in this revision

Viewing changes to xt/release/changes_has_content.t

  • Committer: Package Import Robot
  • Author(s): gregor herrmann, Jonathan Yu, Ansgar Burchardt, gregor herrmann, Salvatore Bonaccorso, Axel Beckert
  • Date: 2013-10-23 21:31:25 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20131023213125-iaciz5s2m8rxirlh
Tags: 0.100051-1
* Team upload.

[ Jonathan Yu ]
* New upstream release
* Update copyright information per upstream

[ Ansgar Burchardt ]
* debian/control: Convert Vcs-* fields to Git.

[ gregor herrmann ]
* debian/control: update {versioned,alternative} (build) dependencies.

[ Salvatore Bonaccorso ]
* Change search.cpan.org based URIs to metacpan.org based URIs

[ Axel Beckert ]
* debian/copyright: migrate pre-1.0 format to 1.0 using "cme fix dpkg-
  copyright"

[ gregor herrmann ]
* New upstream release.
* Switch to "3.0 (quilt)" source format.
* Update years of upstream copyright and license stanzas.
* Bump debhelper compatibility level to 8.
* Declare compliance with Debian Policy 3.9.4.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!perl
 
2
 
 
3
use Test::More tests => 2;
 
4
 
 
5
note 'Checking Changes';
 
6
my $changes_file = 'Changes';
 
7
my $newver = '0.100051';
 
8
my $trial_token = '-TRIAL';
 
9
 
 
10
SKIP: {
 
11
    ok(-e $changes_file, "$changes_file file exists")
 
12
        or skip 'Changes is missing', 1;
 
13
 
 
14
    ok(_get_changes($newver), "$changes_file has content for $newver");
 
15
}
 
16
 
 
17
done_testing;
 
18
 
 
19
# _get_changes copied and adapted from Dist::Zilla::Plugin::Git::Commit
 
20
# by Jerome Quelin
 
21
sub _get_changes
 
22
{
 
23
    my $newver = shift;
 
24
 
 
25
    # parse changelog to find commit message
 
26
    open(my $fh, '<', $changes_file) or die "cannot open $changes_file: $!";
 
27
    my $changelog = join('', <$fh>);
 
28
    close $fh;
 
29
 
 
30
    my @content =
 
31
        grep { /^$newver(?:$trial_token)?(?:\s+|$)/ ... /^\S/ } # from newver to un-indented
 
32
        split /\n/, $changelog;
 
33
    shift @content; # drop the version line
 
34
 
 
35
    # drop unindented last line and trailing blank lines
 
36
    pop @content while ( @content && $content[-1] =~ /^(?:\S|\s*$)/ );
 
37
 
 
38
    # return number of non-blank lines
 
39
    return scalar @content;
 
40
}
 
41