Bug TW-1295

- TW-1295 test/time.t fails on the last day of the month (thanks to Jakub
          Wilk).
This commit is contained in:
Paul Beckingham 2014-04-05 11:25:20 -04:00
parent 5965a85151
commit 6354bc09ab
2 changed files with 30 additions and 19 deletions

View file

@ -27,6 +27,7 @@
use strict;
use warnings;
use POSIX qw(mktime);
use Test::More tests => 7;
# Ensure environment has no influence.
@ -49,30 +50,38 @@ qx{../src/task rc:count.rc add three 2>&1};
qx{../src/task rc:count.rc 2 delete 2>&1};
qx{../src/task rc:count.rc add four wait:eom 2>&1};
# TODO This fails when today == eom. For example, on 2013-04-30 at 8:00:00, the
# value for 'eom' is 2013-04-30 0:00:00, which is already past due, which
# means a second child task is generated. This would be fixed by 'eom'
# expanding to 2013-04-30 24:00:00, as per ISO-8601.
qx{../src/task rc:count.rc add five due:eom recur:monthly 2>&1};
TODO: {
my @today = localtime;
my @tomorrow = @today;
$tomorrow[3] += 1;
@tomorrow = localtime(mktime(@tomorrow));
local $TODO = 'can fail when today == eom' if $today[4] != $tomorrow[4];
diag ("Problem: the next test fails at EOM");
my $output = qx{../src/task rc:count.rc count 2>&1};
like ($output, qr/^5\n/ms, 'count');
# TODO This fails when today == eom. For example, on 2013-04-30 at 8:00:00, the
# value for 'eom' is 2013-04-30 0:00:00, which is already past due, which
# means a second child task is generated. This would be fixed by 'eom'
# expanding to 2013-04-30 24:00:00, as per ISO-8601.
qx{../src/task rc:count.rc add five due:eom recur:monthly 2>&1};
$output = qx{../src/task rc:count.rc count status:deleted rc.debug:1 2>&1};
like ($output, qr/^1\n/ms, 'count status:deleted');
diag ("Problem: the next test fails at EOM");
my $output = qx{../src/task rc:count.rc count 2>&1};
like ($output, qr/^5\n/ms, 'count');
diag ("Problem: the next test fails at EOM");
$output = qx{../src/task rc:count.rc count e 2>&1};
like ($output, qr/^3\n/ms, 'count e');
$output = qx{../src/task rc:count.rc count status:deleted rc.debug:1 2>&1};
like ($output, qr/^1\n/ms, 'count status:deleted');
diag ("Problem: the next test fails at EOM");
$output = qx{../src/task rc:count.rc count description.startswith:f 2>&1};
like ($output, qr/^2\n/ms, 'count description.startswith:f');
diag ("Problem: the next test fails at EOM");
$output = qx{../src/task rc:count.rc count e 2>&1};
like ($output, qr/^3\n/ms, 'count e');
diag ("Problem: the next test fails at EOM");
$output = qx{../src/task rc:count.rc count due.any: 2>&1};
like ($output, qr/^1\n/ms, 'count due.any:');
diag ("Problem: the next test fails at EOM");
$output = qx{../src/task rc:count.rc count description.startswith:f 2>&1};
like ($output, qr/^2\n/ms, 'count description.startswith:f');
diag ("Problem: the next test fails at EOM");
$output = qx{../src/task rc:count.rc count due.any: 2>&1};
like ($output, qr/^1\n/ms, 'count due.any:');
}
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data count.rc);