mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Unit Tests
- Upgraded to use the new template.
This commit is contained in:
parent
bd12ae96e3
commit
5c194f4847
1 changed files with 18 additions and 14 deletions
|
@ -33,30 +33,34 @@ use Test::More tests => 6;
|
|||
delete $ENV{'TASKDATA'};
|
||||
delete $ENV{'TASKRC'};
|
||||
|
||||
use File::Basename;
|
||||
my $ut = basename ($0);
|
||||
my $rc = $ut . '.rc';
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'bug.rc')
|
||||
if (open my $fh, '>', $rc)
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
close $fh;
|
||||
}
|
||||
|
||||
# Bug 879: Backslash at end of description/annotation causes problems.
|
||||
qx{../src/task rc:bug.rc add one\\\\ 2>&1};
|
||||
my $output = qx{../src/task rc:bug.rc long 2>&1};
|
||||
like ($output, qr/one\\/, 'Backslash preserved in description');
|
||||
qx{../src/task rc:$rc add one\\\\ 2>&1};
|
||||
my $output = qx{../src/task rc:$rc long 2>&1};
|
||||
like ($output, qr/one\\/, "$ut: Backslash preserved in description");
|
||||
|
||||
qx{../src/task rc:bug.rc 1 annotate foo\\\\ 2>&1};
|
||||
$output = qx{../src/task rc:bug.rc long 2>&1};
|
||||
like ($output, qr/one\\/, 'Backslash preserved in description');
|
||||
like ($output, qr/foo\\/, 'Backslash preserved in annotation 1');
|
||||
qx{../src/task rc:$rc 1 annotate foo\\\\ 2>&1};
|
||||
$output = qx{../src/task rc:$rc long 2>&1};
|
||||
like ($output, qr/one\\/, "$ut: Backslash preserved in description");
|
||||
like ($output, qr/foo\\/, "$ut: Backslash preserved in annotation 1");
|
||||
|
||||
qx{../src/task rc:bug.rc 1 annotate bar\\\\ 2>&1};
|
||||
$output = qx{../src/task rc:bug.rc long 2>&1};
|
||||
like ($output, qr/one\\/, 'Backslash preserved in description');
|
||||
like ($output, qr/foo\\/, 'Backslash preserved in annotation 1');
|
||||
like ($output, qr/bar\\/, 'Backslash preserved in annotation 2');
|
||||
qx{../src/task rc:$rc 1 annotate bar\\\\ 2>&1};
|
||||
$output = qx{../src/task rc:$rc long 2>&1};
|
||||
like ($output, qr/one\\/, "$ut: Backslash preserved in description");
|
||||
like ($output, qr/foo\\/, "$ut: Backslash preserved in annotation 1");
|
||||
like ($output, qr/bar\\/, "$ut: Backslash preserved in annotation 2");
|
||||
|
||||
# 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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue