mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-20 04:13:07 +02:00
Unit Tests
- Upgraded to use the new template.
This commit is contained in:
parent
90e43fa6f8
commit
959d3cb07d
1 changed files with 15 additions and 11 deletions
|
@ -33,8 +33,12 @@ use Test::More tests => 4;
|
|||
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",
|
||||
"confirmation=off\n";
|
||||
|
@ -42,18 +46,18 @@ if (open my $fh, '>', 'bug.rc')
|
|||
}
|
||||
|
||||
# Bug 917: escaping runs amok
|
||||
qx{../src/task rc:bug.rc add one \\'two\\' three 2>&1};
|
||||
qx{../src/task rc:bug.rc add four \\"five\\" six 2>&1};
|
||||
my $output = qx{../src/task rc:bug.rc list 2>&1};
|
||||
like ($output, qr/one 'two' three/, 'Single quote preserved');
|
||||
like ($output, qr/four "five" six/, 'Double quote preserved');
|
||||
qx{../src/task rc:$rc add one \\'two\\' three 2>&1};
|
||||
qx{../src/task rc:$rc add four \\"five\\" six 2>&1};
|
||||
my $output = qx{../src/task rc:$rc list 2>&1};
|
||||
like ($output, qr/one 'two' three/, "$ut: Single quote preserved");
|
||||
like ($output, qr/four "five" six/, "$ut: Double quote preserved");
|
||||
|
||||
qx{../src/task rc:bug.rc 1,2 mod +tag 2>&1};
|
||||
$output = qx{../src/task rc:bug.rc list 2>&1};
|
||||
like ($output, qr/one 'two' three/, 'Single quote preserved after modification');
|
||||
like ($output, qr/four "five" six/, 'Double quote preserved after modification');
|
||||
qx{../src/task rc:$rc 1,2 mod +tag 2>&1};
|
||||
$output = qx{../src/task rc:$rc list 2>&1};
|
||||
like ($output, qr/one 'two' three/, "$ut: Single quote preserved after modification");
|
||||
like ($output, qr/four "five" six/, "$ut: Double quote preserved after modification");
|
||||
|
||||
# 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