mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Unit Tests
- Tests now conform to template.
This commit is contained in:
parent
a2936c045c
commit
dc53d9c60e
1 changed files with 15 additions and 11 deletions
|
@ -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, '>', 'bug.rc')
|
if (open my $fh, '>', $rc)
|
||||||
{
|
{
|
||||||
print $fh "data.location=.\n",
|
print $fh "data.location=.\n",
|
||||||
"alias.from=to\n";
|
"alias.from=to\n";
|
||||||
|
@ -42,20 +46,20 @@ if (open my $fh, '>', 'bug.rc')
|
||||||
}
|
}
|
||||||
|
|
||||||
# Bug 1031: -- does not bypass aliasing
|
# Bug 1031: -- does not bypass aliasing
|
||||||
qx{../src/task rc:bug.rc add from 2>&1};
|
qx{../src/task rc:$rc add from 2>&1};
|
||||||
qx{../src/task rc:bug.rc add from -- to 2>&1};
|
qx{../src/task rc:$rc add from -- to 2>&1};
|
||||||
qx{../src/task rc:bug.rc add to -- from 2>&1};
|
qx{../src/task rc:$rc add to -- from 2>&1};
|
||||||
|
|
||||||
my $output = qx{../src/task rc:bug.rc 1 info 2>&1};
|
my $output = qx{../src/task rc:$rc 1 info 2>&1};
|
||||||
like ($output, qr/Description\s+to$/ms, "'from' --> 'to'");
|
like ($output, qr/Description\s+to$/ms, "$ut: 'from' --> 'to'");
|
||||||
|
|
||||||
$output = qx{../src/task rc:bug.rc 2 info 2>&1};
|
$output = qx{../src/task rc:$rc 2 info 2>&1};
|
||||||
like ($output, qr/Description\s+to to$/ms, "'from -- to' --> 'to to'");
|
like ($output, qr/Description\s+to to$/ms, "$ut: 'from -- to' --> 'to to'");
|
||||||
|
|
||||||
$output = qx{../src/task rc:bug.rc 3 info 2>&1};
|
$output = qx{../src/task rc:$rc 3 info 2>&1};
|
||||||
like ($output, qr/Description\s+to from$/ms, "'to -- from' --> 'to from'");
|
like ($output, qr/Description\s+to from$/ms, "$ut: 'to -- from' --> 'to from'");
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink qw(pending.data completed.data undo.data backlog.data bug.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