Unit Tests
- Upgraded to use the new template.
This commit is contained in:
@@ -33,8 +33,12 @@ use Test::More tests => 3;
|
|||||||
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, '>', 'range.rc')
|
if (open my $fh, '>', $rc)
|
||||||
{
|
{
|
||||||
print $fh "data.location=.\n",
|
print $fh "data.location=.\n",
|
||||||
"confirmation=no\n",
|
"confirmation=no\n",
|
||||||
@@ -43,15 +47,15 @@ if (open my $fh, '>', 'range.rc')
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Add three tasks, and attempt to list the middle one within a range.
|
# Add three tasks, and attempt to list the middle one within a range.
|
||||||
qx{../src/task rc:range.rc add one due:8/1/2009 2>&1};
|
qx{../src/task rc:$rc add one due:8/1/2009 2>&1};
|
||||||
qx{../src/task rc:range.rc add two due:8/3/2009 2>&1};
|
qx{../src/task rc:$rc add two due:8/3/2009 2>&1};
|
||||||
qx{../src/task rc:range.rc add three due:8/5/2009 2>&1};
|
qx{../src/task rc:$rc add three due:8/5/2009 2>&1};
|
||||||
my $output = qx{../src/task rc:range.rc ls due.after:8/2/2009 due.before:8/4/2009 2>&1};
|
my $output = qx{../src/task rc:$rc ls due.after:8/2/2009 due.before:8/4/2009 2>&1};
|
||||||
unlike ($output, qr/one/, 'Missing prior to range');
|
unlike ($output, qr/one/, "$ut: Missing prior to range");
|
||||||
like ($output, qr/two/, 'Found within range');
|
like ($output, qr/two/, "$ut: Found within range");
|
||||||
unlike ($output, qr/three/, 'Missing after range');
|
unlike ($output, qr/three/, "$ut: Missing after range");
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink qw(pending.data completed.data undo.data backlog.data range.rc);
|
unlink qw(pending.data completed.data undo.data backlog.data), $rc;
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user