File: valid_dates.t

package info (click to toggle)
libcpan-changes-perl 0.500005-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,964 kB
  • sloc: perl: 988; makefile: 2
file content (23 lines) | stat: -rw-r--r-- 398 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use strict;
use warnings;

use Test::More;

use CPAN::Changes;

my @dates = (
    '2000',
    '2000-01',
    '2000-01-01',
    '2000-01-01T12:00',
    '2000-01-01T12:00Z',
    '2000-01-01T12:00+04:00',
    '2000-01-01T12:00+04:00:00',
    '2000-01-01 12:00', # optional "T"
);

for my $date ( @dates ) {
    ok( $date =~ m[^${CPAN::Changes::W3CDTF_REGEX}$], "Valid Date: $date" );
}

done_testing;