mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Unit Tests
- Upgraded to use the new template.
This commit is contained in:
parent
1dba267120
commit
4e57c6002e
1 changed files with 15 additions and 11 deletions
|
@ -33,8 +33,12 @@ use Test::More tests => 3;
|
|||
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=no\n";
|
||||
|
@ -49,13 +53,13 @@ if (open my $fh, '>', 'bug.rc')
|
|||
#
|
||||
# Thisisanewdescription
|
||||
|
||||
qx{../src/task rc:bug.rc add This is the original text 2>&1};
|
||||
my $output = qx{../src/task rc:bug.rc info 1 2>&1};
|
||||
like ($output, qr/Description\s+This is the original text/, 'original correct');
|
||||
qx{../src/task rc:$rc add This is the original text 2>&1};
|
||||
my $output = qx{../src/task rc:$rc info 1 2>&1};
|
||||
like ($output, qr/Description\s+This is the original text/, "$ut: original correct");
|
||||
|
||||
qx{../src/task rc:bug.rc 1 modify This is the modified text 2>&1};
|
||||
$output = qx{../src/task rc:bug.rc info 1 2>&1};
|
||||
like ($output, qr/Description\s+This is the modified text\n/, 'modified correct');
|
||||
qx{../src/task rc:$rc 1 modify This is the modified text 2>&1};
|
||||
$output = qx{../src/task rc:$rc info 1 2>&1};
|
||||
like ($output, qr/Description\s+This is the modified text\n/, "$ut: modified correct");
|
||||
|
||||
# When a task is added like this:
|
||||
#
|
||||
|
@ -65,11 +69,11 @@ like ($output, qr/Description\s+This is the modified text\n/, 'modified correct'
|
|||
#
|
||||
# aaabbb:ccc ddd
|
||||
|
||||
qx{../src/task rc:bug.rc add aaa bbb:ccc ddd 2>&1};
|
||||
$output = qx{../src/task rc:bug.rc info 2 2>&1};
|
||||
like ($output, qr/Description\s+aaa bbb:ccc ddd\n/, 'properly concatenated');
|
||||
qx{../src/task rc:$rc add aaa bbb:ccc ddd 2>&1};
|
||||
$output = qx{../src/task rc:$rc info 2 2>&1};
|
||||
like ($output, qr/Description\s+aaa bbb:ccc ddd\n/, "$ut: properly concatenated");
|
||||
|
||||
# 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