1. Shlomi Fish
  2. perl-App-Countdown

Commits

Shlomi Fish  committed db2db19

Add the 1m30s notation.

  • Participants
  • Parent commits 48011ff
  • Branches default

Comments (0)

Files changed (2)

File App-Countdown/lib/App/Countdown.pm

View file
             )
         );
     }
+    elsif (my ($min, $sec) = $delay_spec =~ /\A([1-9][0-9]*)m([1-5][0-9]|0{1,2})s\z/)
+    {
+        return $min * 60 + $sec;
+    }
     else
     {
         die "Invalid delay. Must be a positive and possibly fractional number, possibly followed by s, m, or h";

File App-Countdown/t/unit-calc-delay.t

View file
 use strict;
 use warnings;
 
-use Test::More tests => 10;
+use Test::More tests => 11;
 
 use App::Countdown;
 
 
     # TEST
     is ($obj->_calc_delay('90s'), 90, "_calc_delay(90s) == 90 (seconds)");
+
+    # TEST
+    is ($obj->_calc_delay('1m30s'), 60+30, "_calc_delay(1m30s) == 60+30 (seconds)");
 }