Blame t/strptime.t

Packit 9002b2
use strict;
Packit 9002b2
use warnings;
Packit 9002b2
Packit 9002b2
use Test::More;
Packit 9002b2
Packit 9002b2
use DateTime::Format::Builder;
Packit 9002b2
Packit 9002b2
my @tests = (
Packit 9002b2
Packit 9002b2
    # Simple dates
Packit 9002b2
    [ '%Y-%m-%d',          '1998-12-31' ],
Packit 9002b2
    [ '%y-%m-%d',          '98-12-31' ],
Packit 9002b2
    [ '%Y years, %j days', '1998 years, 312 days' ],
Packit 9002b2
    [ '%b %d, %Y',         'Jan 24, 2003' ],
Packit 9002b2
    [ '%B %d, %Y',         'January 24, 2003' ],
Packit 9002b2
Packit 9002b2
    # Simple times
Packit 9002b2
    [ '%H:%M:%S',    '23:45:56' ],
Packit 9002b2
    [ '%l:%M:%S %p', '12:34:56 PM' ],
Packit 9002b2
Packit 9002b2
    # With Nanoseconds
Packit 9002b2
    [ '%H:%M:%S.%N',  '23:45:56.123456789' ],
Packit 9002b2
    [ '%H:%M:%S.%6N', '23:45:56.123456' ],
Packit 9002b2
    [ '%H:%M:%S.%3N', '23:45:56.123' ],
Packit 9002b2
Packit 9002b2
    # Complex dates
Packit 9002b2
    [ '%Y;%j = %Y-%m-%d',      '2003;056 = 2003-02-25' ],
Packit 9002b2
    [ q|%d %b '%y = %Y-%m-%d|, q|25 Feb '03 = 2003-02-25| ],
Packit 9002b2
);
Packit 9002b2
Packit 9002b2
for my $test (@tests) {
Packit 9002b2
    my ( $pattern, $data ) = @$test;
Packit 9002b2
    my $parser
Packit 9002b2
        = DateTime::Format::Builder->create_parser( strptime => $pattern );
Packit 9002b2
    my $parsed = $parser->parse( 'DateTime::Format::Builder', $data );
Packit 9002b2
    isa_ok( $parsed => 'DateTime' );
Packit 9002b2
    is( $parsed->strftime($pattern) => $data, $pattern );
Packit 9002b2
}
Packit 9002b2
Packit 9002b2
done_testing();