mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-20 13:23:08 +02:00
Unit Tests
- Upgraded to user the new template. - Removed code that detected EOM an skipped tests. This should no longer be needed with the ISO date support, where EOM is the true EOM.
This commit is contained in:
parent
74526ee564
commit
822031bf0b
1 changed files with 22 additions and 35 deletions
57
test/count.t
57
test/count.t
|
@ -34,8 +34,12 @@ use Test::More tests => 5;
|
||||||
delete $ENV{'TASKDATA'};
|
delete $ENV{'TASKDATA'};
|
||||||
delete $ENV{'TASKRC'};
|
delete $ENV{'TASKRC'};
|
||||||
|
|
||||||
|
use File::Basename;
|
||||||
|
my $ut = basename ($0);
|
||||||
|
my $rc = $ut . '.rc';
|
||||||
|
|
||||||
# Create the rc file.
|
# Create the rc file.
|
||||||
if (open my $fh, '>', 'count.rc')
|
if (open my $fh, '>', $rc)
|
||||||
{
|
{
|
||||||
print $fh "data.location=.\n",
|
print $fh "data.location=.\n",
|
||||||
"confirmation=off\n";
|
"confirmation=off\n";
|
||||||
|
@ -43,46 +47,29 @@ if (open my $fh, '>', 'count.rc')
|
||||||
}
|
}
|
||||||
|
|
||||||
# Test the count command.
|
# Test the count command.
|
||||||
qx{../src/task rc:count.rc add one 2>&1};
|
qx{../src/task rc:$rc add one 2>&1};
|
||||||
qx{../src/task rc:count.rc log two 2>&1};
|
qx{../src/task rc:$rc log two 2>&1};
|
||||||
qx{../src/task rc:count.rc add three 2>&1};
|
qx{../src/task rc:$rc add three 2>&1};
|
||||||
qx{../src/task rc:count.rc 2 delete 2>&1};
|
qx{../src/task rc:$rc 2 delete 2>&1};
|
||||||
qx{../src/task rc:count.rc add four wait:eom 2>&1};
|
qx{../src/task rc:$rc add four wait:eom 2>&1};
|
||||||
|
qx{../src/task rc:$rc add five due:eom recur:monthly 2>&1};
|
||||||
|
|
||||||
TODO: {
|
my $output = qx{../src/task rc:$rc count 2>&1};
|
||||||
my @today = localtime;
|
like ($output, qr/^5\n/ms, "$ut: count");
|
||||||
my @tomorrow = @today;
|
|
||||||
$tomorrow[3] += 1;
|
|
||||||
@tomorrow = localtime(mktime(@tomorrow));
|
|
||||||
local $TODO = 'can fail when today == eom' if $today[4] != $tomorrow[4];
|
|
||||||
|
|
||||||
# TODO This fails when today == eom. For example, on 2013-04-30 at 8:00:00, the
|
$output = qx{../src/task rc:$rc count status:deleted rc.debug:1 2>&1};
|
||||||
# value for 'eom' is 2013-04-30 0:00:00, which is already past due, which
|
like ($output, qr/^1\n/ms, "$ut: count status:deleted");
|
||||||
# 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};
|
|
||||||
|
|
||||||
diag ("Problem: the next test fails at EOM");
|
$output = qx{../src/task rc:$rc count e 2>&1};
|
||||||
my $output = qx{../src/task rc:count.rc count 2>&1};
|
like ($output, qr/^3\n/ms, "$ut: count e");
|
||||||
like ($output, qr/^5\n/ms, 'count');
|
|
||||||
|
|
||||||
$output = qx{../src/task rc:count.rc count status:deleted rc.debug:1 2>&1};
|
$output = qx{../src/task rc:$rc count description.startswith:f 2>&1};
|
||||||
like ($output, qr/^1\n/ms, 'count status:deleted');
|
like ($output, qr/^2\n/ms, "$ut: count description.startswith:f");
|
||||||
|
|
||||||
diag ("Problem: the next test fails at EOM");
|
$output = qx{../src/task rc:$rc count due.any: 2>&1};
|
||||||
$output = qx{../src/task rc:count.rc count e 2>&1};
|
like ($output, qr/^1\n/ms, "$ut: count due.any:");
|
||||||
like ($output, qr/^3\n/ms, 'count e');
|
|
||||||
|
|
||||||
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.
|
# Cleanup.
|
||||||
unlink qw(pending.data completed.data undo.data backlog.data count.rc);
|
unlink qw(pending.data completed.data undo.data backlog.data), $rc;
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue