Changeset 2409

Show
Ignore:
Timestamp:
01/05/08 10:11:56
Author:
miyagawa
Message:

apply patch from http://rt.cpan.org/Ticket/Display.html?id=32078

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Time-Duration-Parse/trunk/lib/Time/Duration/Parse.pm

    r2390 r2409  
    2727 
    2828    my $duration = 0; 
    29     while ($timespec =~ s/^\s*(-?\d+)\s*(\w+)(?:\s*(?:,|and)\s*)*//i) { 
     29    while ($timespec =~ s/^\s*(-?\d+)\s*([a-zA-Z]+)(?:\s*(?:,|and)\s*)*//i) { 
    3030        my($amount, $unit) = ($1, $2); 
    3131        $unit = lc($unit) unless length($unit) == 1; 
  • Time-Duration-Parse/trunk/t/02_roundtrip.t

    r1879 r2409  
    88} 
    99 
    10 plan tests => 1000; 
     10plan tests => 2000; 
    1111 
    1212my @tests = map int rand(100_000), 1..1000; 
     
    1717} 
    1818 
     19for my $test (@tests) { 
     20    my $spec = Time::Duration::concise(Time::Duration::duration_exact($test)); 
     21    is parse_duration($spec), $test, "$spec - $test"; 
     22} 
    1923