mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-22 20:23:09 +02:00
Unit Tests
- Tests now conform to template.
This commit is contained in:
parent
784b14c69a
commit
5b2505f6da
1 changed files with 15 additions and 11 deletions
|
@ -33,28 +33,32 @@ use Test::More tests => 2;
|
||||||
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, '>', 'uda.rc')
|
if (open my $fh, '>', $rc)
|
||||||
{
|
{
|
||||||
print $fh "data.location=.\n",
|
print $fh "data.location=.\n",
|
||||||
"confirmation=off\n",
|
"confirmation=off\n",
|
||||||
"uda.extra.type=string\n",
|
"uda.extra.type=string\n",
|
||||||
"uda.extra.label=Extra\n",
|
"uda.extra.label=Extra\n",
|
||||||
"report.uda.description=UDA Test\n",
|
"report.uuu.description=UDA Test\n",
|
||||||
"report.uda.columns=id,extra,description\n",
|
"report.uuu.columns=id,extra,description\n",
|
||||||
"report.uda.sort=extra,description\n",
|
"report.uuu.sort=extra,description\n",
|
||||||
"report.uda.labels=ID,Extra,Description\n";
|
"report.uuu.labels=ID,Extra,Description\n";
|
||||||
close $fh;
|
close $fh;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add tasks with and without the UDA.
|
# Add tasks with and without the UDA.
|
||||||
qx{../src/task rc:uda.rc add with extra:"one two" 2>&1};
|
qx{../src/task rc:$rc add with extra:"one two" 2>&1};
|
||||||
qx{../src/task rc:uda.rc add without 2>&1};
|
qx{../src/task rc:$rc add without 2>&1};
|
||||||
my $output = qx{../src/task rc:uda.rc uda 2>&1};
|
my $output = qx{../src/task rc:$rc uuu 2>&1};
|
||||||
like ($output, qr/1\s+one two\s+with/, 'UDA string stored');
|
like ($output, qr/1\s+one two\s+with/, "$ut: UDA string stored");
|
||||||
like ($output, qr/2\s+without/, 'UDA string blank');
|
like ($output, qr/2\s+without/, "$ut: UDA string blank");
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink qw(pending.data completed.data undo.data backlog.data uda.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