File: 95changedate.t

package info (click to toggle)
libtemplate-plugin-digest-md5-perl 0.05-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 124 kB
  • sloc: perl: 147; makefile: 2
file content (39 lines) | stat: -rw-r--r-- 1,275 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
#!/usr/bin/perl -w
use strict;

use Test::More;
use IO::File;

# Skip if doing a regular install
plan skip_all => "Author tests not required for installation"
    unless ( $ENV{AUTOMATED_TESTING} );

my $fh = IO::File->new('Changes','r')   or plan skip_all => "Cannot open Changes file";

plan 'no_plan';

use Template::Plugin::Digest::MD5;
my $version = $Template::Plugin::Digest::MD5::VERSION;

my $latest = 0;
while(<$fh>) {
    next        unless(m!^\d!);
    $latest = 1 if(m!^$version!);

    # 2012-08-26T01:02 or 2012-08-26T01:02:03 or 2012-08-26T01:02:03.04 or 2012-08-26T01:02+01:00

    like($_, qr!    \d[\d._]+\s+                # version
                    (   \d{4}-\d{2}-\d{2}       # 2012-08-26    - YYYY-MM-DD
                        (   T\d{2}:\d{2}        # T01:02        - Thh:mm
                            (   :\d{2}          # :02           - :ss
                                (   \.\d+       # .2            - .ss (microseconds)
                                )?
                            )?
                            (   (Z|[-+]\d+:\d+) # +01:00        - timezone
                            )?
                        )?
                    ) 
                !x,'... version has a date');
}

is($latest,1,'... latest version not listed');