#!perl -T
can_ok(
'Date::Lectionary::Time'
,
qw(closestSunday)
);
my
$closestSundayTimePieceObject
= closestSunday(Time::Piece->strptime(
"2016-01-01"
,
"%Y-%m-%d"
));
isa_ok(
$closestSundayTimePieceObject
,
'Time::Piece'
);
is(
closestSunday(Time::Piece->strptime(
"2016-01-01"
,
"%Y-%m-%d"
)),
Time::Piece->strptime(
"2016-01-03"
,
"%Y-%m-%d"
),
'Sunday closest to 2016-01-01 is 2016-01-03'
);
is(
closestSunday(Time::Piece->strptime(
"2016-01-03"
,
"%Y-%m-%d"
)),
Time::Piece->strptime(
"2016-01-03"
,
"%Y-%m-%d"
),
'Sunday closest to 2016-01-03 is 2016-01-03'
);
is(
closestSunday(Time::Piece->strptime(
"2016-08-09"
,
"%Y-%m-%d"
)),
Time::Piece->strptime(
"2016-08-07"
,
"%Y-%m-%d"
),
'Sunday closest to 2016-08-09 is 2016-08-07'
);