Unit Tests

- Fixed 'witching hour' bug in unit tests that causes problems when run
  in assorted time zones.  By using str2time to get the epoch value of
  a known local time, this should fix failures that occur.

Signed-off-by: Paul Beckingham <paul@beckingham.net>
This commit is contained in:
Owen Clarke 2012-02-25 23:13:41 -05:00 committed by Paul Beckingham
parent 049f34d339
commit 7c2d97d939

View file

@ -28,6 +28,7 @@
use strict;
use warnings;
use Date::Parse;
use Test::More tests => 17;
# Create the rc file.
@ -43,11 +44,11 @@ if (open my $fh, '>', 'before.rc')
# Create some exampel data directly.
if (open my $fh, '>', 'pending.data')
{
# 1229947200 = 12/22/2008
# 1240000000 = 4/17/2009
my $timeA = str2time("2008-12-22 12:00:00");
my $timeB = str2time("2009-04-17 12:00:00");
print $fh <<EOF;
[description:"foo" entry:"1229947200" start:"1229947200" status:"pending" uuid:"27097693-91c2-4cbe-ba89-ddcc87e5582c"]
[description:"bar" entry:"1240000000" start:"1240000000" status:"pending" uuid:"08f72d91-964c-424b-8fd5-556434648b6b"]
[description:"foo" entry:"$timeA" start:"$timeA" status:"pending" uuid:"27097693-91c2-4cbe-ba89-ddcc87e5582c"]
[description:"bar" entry:"$timeB" start:"$timeB" status:"pending" uuid:"08f72d91-964c-424b-8fd5-556434648b6b"]
EOF
close $fh;