1use strict; 2use warnings; 3no warnings 'deprecated'; 4 5use Test::More tests => 5; 6 7BEGIN { use_ok('Time::Piece'); } 8 9# The parse() legacy method is deprecated and will not be maintained. 10# The tests in this script illustrate both its functionality and some of 11# its bugs. This script should be removed from the test suite once 12# parse() has been deleted from Time::Piece. 13 14SKIP: { 15 skip "Linux only", 4 if $^O !~ /linux/i; 16 17 my $timestring = '2000-01-01T06:00:00'; 18 my $t1 = Time::Piece->parse($timestring); 19 isnt( $t1->datetime, $timestring, 'LEGACY: parse string months fail' ); 20 my $t2 = $t1->parse( 0, 0, 6, 1, 0, 100 ); 21 is( $t2->datetime, $timestring, 'LEGACY: parse array' ); 22 eval { $t2 = Time::Piece->parse(); }; 23 is( $t2->datetime, $timestring, 'LEGACY: parse with no args dies' ); 24 eval { $t2 = Time::Piece::parse( 0, 0, 12, 1, 0, 100 ); }; 25 is( $t2->datetime, $timestring, 'LEGACY: parse as non-method dies' ); 26} 27