mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Unit Tests
- Updated uda_defaults to the new template.
This commit is contained in:
parent
05b1d30c0a
commit
55fddd66d1
1 changed files with 16 additions and 12 deletions
|
@ -33,8 +33,12 @@ use Test::More tests => 6;
|
||||||
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",
|
||||||
|
@ -52,23 +56,23 @@ if (open my $fh, '>', 'uda.rc')
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add task with nondefault UDA
|
# Add task with nondefault UDA
|
||||||
my $output = qx{../src/task rc:uda.rc add one smell:strong 2>&1};
|
my $output = qx{../src/task rc:$rc add one smell:strong 2>&1};
|
||||||
like ($output, qr/Created task 1/, 'Add 1 - no errors');
|
like ($output, qr/Created task 1/, "$ut: Add 1 - no errors");
|
||||||
|
|
||||||
# Add task without a UDA value, checking for usage of the default
|
# Add task without a UDA value, checking for usage of the default
|
||||||
$output = qx{../src/task rc:uda.rc add two 2>&1};
|
$output = qx{../src/task rc:$rc add two 2>&1};
|
||||||
like ($output, qr/Created task 2/, 'Add 2 - no errors');
|
like ($output, qr/Created task 2/, "$ut: Add 2 - no errors");
|
||||||
|
|
||||||
# Add a task with a UDA that has no default, ensure it is entered fine
|
# Add a task with a UDA that has no default, ensure it is entered fine
|
||||||
$output = qx{../src/task rc:uda.rc add three size:10 2>&1};
|
$output = qx{../src/task rc:$rc add three size:10 2>&1};
|
||||||
like ($output, qr/Created task 3/, 'Add 3 - no errors');
|
like ($output, qr/Created task 3/, "$ut: Add 3 - no errors");
|
||||||
|
|
||||||
$output = qx{../src/task rc:uda.rc uda 2>&1};
|
$output = qx{../src/task rc:$rc uda 2>&1};
|
||||||
like ($output, qr/1\s+strong\s+one/, 'UDA nondefault stored');
|
like ($output, qr/1\s+strong\s+one/, "$ut: UDA nondefault stored");
|
||||||
like ($output, qr/2\s+weak\s+two/, 'UDA default stored');
|
like ($output, qr/2\s+weak\s+two/, "$ut: UDA default stored");
|
||||||
like ($output, qr/3\s+weak\s+10\s+three/, 'UDA without default stored');
|
like ($output, qr/3\s+weak\s+10\s+three/, "$ut: UDA without default stored");
|
||||||
|
|
||||||
# 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