~ubuntu-branches/ubuntu/oneiric/libdatetimex-easy-perl/oneiric

« back to all changes in this revision

Viewing changes to t/release/boilerplate.t

  • Committer: Bazaar Package Importer
  • Author(s): gregor herrmann
  • Date: 2010-08-28 01:45:16 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100828014516-5j19aql8jw9y4567
Tags: 0.089-1
* New upstream release.
* Convert to source format 3.0 (quilt).
* Add /me to Uploaders.
* debian/copyright: update years of upstream copyright.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!perl -T
2
 
 
3
 
use strict;
4
 
use warnings;
5
 
use Test::More tests => 3;
6
 
 
7
 
sub not_in_file_ok {
8
 
    my ($filename, %regex) = @_;
9
 
    open( my $fh, '<', $filename )
10
 
        or die "couldn't open $filename for reading: $!";
11
 
 
12
 
    my %violated;
13
 
 
14
 
    while (my $line = <$fh>) {
15
 
        while (my ($desc, $regex) = each %regex) {
16
 
            if ($line =~ $regex) {
17
 
                push @{$violated{$desc}||=[]}, $.;
18
 
            }
19
 
        }
20
 
    }
21
 
 
22
 
    if (%violated) {
23
 
        fail("$filename contains boilerplate text");
24
 
        diag "$_ appears on lines @{$violated{$_}}" for keys %violated;
25
 
    } else {
26
 
        pass("$filename contains no boilerplate text");
27
 
    }
28
 
}
29
 
 
30
 
sub module_boilerplate_ok {
31
 
    my ($module) = @_;
32
 
    not_in_file_ok($module =>
33
 
        'the great new $MODULENAME'   => qr/ - The great new /,
34
 
        'boilerplate description'     => qr/Quick summary of what the module/,
35
 
        'stub function definition'    => qr/function[12]/,
36
 
    );
37
 
}
38
 
 
39
 
TODO: {
40
 
  local $TODO = "Need to replace the boilerplate text";
41
 
 
42
 
  not_in_file_ok(README =>
43
 
    "The README is used..."       => qr/The README is used/,
44
 
    "'version information here'"  => qr/to provide version information/,
45
 
  );
46
 
 
47
 
  not_in_file_ok(Changes =>
48
 
    "placeholder date/time"       => qr(Date/time)
49
 
  );
50
 
 
51
 
  module_boilerplate_ok('lib/DateTimeX/Easy.pm');
52
 
 
53
 
 
54
 
}
55