From fa5764dbc1cd4e640f02baa59edd3d56c6ac22d7 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Wed, 22 Sep 2010 10:49:16 -0700 Subject: [PATCH] Add tests for inclusive intervals for secondsToDuration --- t/Session/DateTime.t | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/t/Session/DateTime.t b/t/Session/DateTime.t index a9601f6c3..e2a066319 100644 --- a/t/Session/DateTime.t +++ b/t/Session/DateTime.t @@ -17,7 +17,7 @@ use File::Spec; use WebGUI::Test; use WebGUI::Session; -use Test::More tests => 90; # increment this value for each test you create +use Test::More tests => 92; # increment this value for each test you create installBadLocale(); WebGUI::Test->addToCleanup(sub { unlink File::Spec->catfile(WebGUI::Test->lib, qw/WebGUI i18n BadLocale.pm/); }); @@ -218,16 +218,18 @@ cmp_ok( #################################################### is(join(" ",$dt->secondsToInterval(60*60*24*365*2)), "2 Year(s)", "secondsToInterval(), years"); -is(join(" ",$dt->secondsToInterval(60*60*24*180)), "6 Month(s)", "secondsToInterval(), months"); -is(join(" ",$dt->secondsToInterval(60*60*24*7*3)), "3 Week(s)", "secondsToInterval(), weeks"); -is(join(" ",$dt->secondsToInterval(60*60*24*5)), "5 Day(s)", "secondsToInterval(), days"); -is(join(" ",$dt->secondsToInterval(60*60*24*8)), "1 Week(s)", "secondsToInterval(), days, longer than a week"); -is(join(" ",$dt->secondsToInterval(60*60*24*363)), "12 Month(s)", "secondsToInterval(), days, longer than a month"); -is(join(" ",$dt->secondsToInterval(60*60*24*365*2.4)), "2 Year(s)", "secondsToInterval(), days, longer than a year"); -is(join(" ",$dt->secondsToInterval(60*60*18)), "18 Hour(s)", "secondsToInterval(), hours"); -is(join(" ",$dt->secondsToInterval(60*60*24*365*2.9)), "3 Year(s)", "secondsToInterval(), hours, longer than a year"); -is(join(" ",$dt->secondsToInterval(60*27)), "27 Minute(s)", "secondsToInterval(), minutes"); -is(join(" ",$dt->secondsToInterval(59)), "59 Second(s)", "secondsToInterval(), seconds"); +is(join(" ",$dt->secondsToInterval(60*60*24*180)), "6 Month(s)", "... months"); +is(join(" ",$dt->secondsToInterval(60*60*24*7*3)), "3 Week(s)", "... weeks"); +is(join(" ",$dt->secondsToInterval(60*60*24*5)), "5 Day(s)", "... days"); +is(join(" ",$dt->secondsToInterval(60*60*24*8)), "1 Week(s)", "... days, longer than a week"); +is(join(" ",$dt->secondsToInterval(60*60*24*363)), "12 Month(s)", "... days, longer than a month"); +is(join(" ",$dt->secondsToInterval(60*60*24*365*2.4)), "2 Year(s)", "... days, longer than a year"); +is(join(" ",$dt->secondsToInterval(60*60*18)), "18 Hour(s)", "... hours"); +is(join(" ",$dt->secondsToInterval(60*60*24*365*2.9)), "3 Year(s)", "... hours, longer than a year"); +is(join(" ",$dt->secondsToInterval(60*27)), "27 Minute(s)", "... minutes"); +is(join(" ",$dt->secondsToInterval(59)), "59 Second(s)", "... seconds"); +is(join(" ",$dt->secondsToInterval(3600)), "1 Hour(s)", "... exactly 1 hour"); +is(join(" ",$dt->secondsToInterval(60)), "1 Minute(s)", "... exactly 1 minute"); #################################################### #