Unit Tests
- Replaced 'sleep' commands in the unit test (which slow things down too much) with pending.data lines with modified timestamps.
This commit is contained in:
@@ -36,25 +36,36 @@ delete $ENV{'TASKRC'};
|
|||||||
# Create the rc file.
|
# Create the rc file.
|
||||||
if (open my $fh, '>', 'recur.rc')
|
if (open my $fh, '>', 'recur.rc')
|
||||||
{
|
{
|
||||||
print $fh "data.location=.\n";
|
print $fh "data.location=.\n",
|
||||||
|
"bulk=10\n",
|
||||||
|
"dateformat=Y-M-DTH:N:S\n";
|
||||||
close $fh;
|
close $fh;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create a few recurring tasks, and test the sort order of the recur column.
|
# Create a few recurring tasks, and test the sort order of the recur column.
|
||||||
qx{../src/task rc:recur.rc add foo due:now recur:2sec until:5sec 2>&1};
|
|
||||||
diag ("Sleeping for 6 seconds");
|
if (open my $fh, '>', 'pending.data')
|
||||||
sleep 6;
|
{
|
||||||
|
my $until = time () - 2;
|
||||||
|
my $entry = $until - 5;
|
||||||
|
|
||||||
|
print $fh <<EOF;
|
||||||
|
[uuid:"00000000-0000-0000-0000-000000000000" status:"recurring" description:"foo" entry:"$entry" due:"$entry" recur:"PT2S" until:"$until"]
|
||||||
|
EOF
|
||||||
|
close $fh;
|
||||||
|
}
|
||||||
|
|
||||||
my $output = qx{../src/task rc:recur.rc list 2>&1};
|
my $output = qx{../src/task rc:recur.rc list 2>&1};
|
||||||
like ($output, qr/^\s+2/ms, 'Found 2');
|
like ($output, qr/^\s+2/ms, 'Found 2');
|
||||||
like ($output, qr/^\s+3/ms, 'Found 3');
|
like ($output, qr/^\s+3/ms, 'Found 3');
|
||||||
like ($output, qr/^\s+4/ms, 'Found 4');
|
like ($output, qr/^\s+4/ms, 'Found 4');
|
||||||
like ($output, qr/^\s+5/ms, 'Found 5');
|
like ($output, qr/^\s+5/ms, 'Found 5');
|
||||||
|
|
||||||
qx{../src/task rc:recur.rc 2 done 2>&1};
|
# There may be more than 4, but we don't care, because they must all now be
|
||||||
qx{../src/task rc:recur.rc 3 done 2>&1};
|
# removed.
|
||||||
qx{../src/task rc:recur.rc 4 done 2>&1};
|
qx{../src/task rc:recur.rc status:pending and /foo/ done 2>&1};
|
||||||
qx{../src/task rc:recur.rc 5 done 2>&1};
|
|
||||||
$output = qx{../src/task rc:recur.rc list 2>&1 >/dev/null};
|
$output = qx{../src/task rc:recur.rc list 2>&1};
|
||||||
like ($output, qr/and was deleted/, 'Parent task deleted');
|
like ($output, qr/and was deleted/, 'Parent task deleted');
|
||||||
|
|
||||||
$output = qx{../src/task rc:recur.rc diag 2>&1};
|
$output = qx{../src/task rc:recur.rc diag 2>&1};
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Test::More tests => 4;
|
use Test::More tests => 3;
|
||||||
|
|
||||||
# Ensure environment has no influence.
|
# Ensure environment has no influence.
|
||||||
delete $ENV{'TASKDATA'};
|
delete $ENV{'TASKDATA'};
|
||||||
@@ -71,7 +71,6 @@ if (open my $fh, '>', 'pending.data')
|
|||||||
[uuid:"99999999-9999-9999-9999-999999999999 " status:"completed" description:"C2" entry:"$fourteen" end:"$fourteen"]
|
[uuid:"99999999-9999-9999-9999-999999999999 " status:"completed" description:"C2" entry:"$fourteen" end:"$fourteen"]
|
||||||
EOF
|
EOF
|
||||||
close $fh;
|
close $fh;
|
||||||
ok (-r 'pending.data', 'Created pending.data');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
my $output = qx{../src/task rc:time.rc timesheet 2>&1};
|
my $output = qx{../src/task rc:time.rc timesheet 2>&1};
|
||||||
|
|||||||
Reference in New Issue
Block a user