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

@ -37,6 +37,8 @@ Bugs
- TW-1282 incorrect URLs in man task-sync (thanks to Jeremiah Marks). - TW-1282 incorrect URLs in man task-sync (thanks to Jeremiah Marks).
- TW-1288 Added missing locking for task modifications (thanks to Kosta H, - TW-1288 Added missing locking for task modifications (thanks to Kosta H,
Ralph Bean, Adam Coddington). Ralph Bean, Adam Coddington).
- TW-1295 test/time.t fails on the last day of the month (thanks to Jakub
Wilk).
- TW-1296 make test/run_all exit with non-zero code if a test fail (thanks to - TW-1296 make test/run_all exit with non-zero code if a test fail (thanks to
Jakub Wilk). Jakub Wilk).
- #1511 sync init crashes if client certification file is empty or invalid - #1511 sync init crashes if client certification file is empty or invalid

View file

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