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
333fd945f6
commit
0b471401cb
1 changed files with 13 additions and 9 deletions
|
@ -33,26 +33,30 @@ 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";
|
||||
close $fh;
|
||||
}
|
||||
|
||||
# Attempt a blank annotation.
|
||||
qx{../src/task rc:bug.rc add foo 2>&1};
|
||||
my $output = qx{../src/task rc:bug.rc 1 annotate 2>&1 >/dev/null};
|
||||
like ($output, qr/Additional text must be provided/, 'failed on blank annotation');
|
||||
qx{../src/task rc:$rc add foo 2>&1};
|
||||
my $output = qx{../src/task rc:$rc 1 annotate 2>&1 >/dev/null};
|
||||
like ($output, qr/Additional text must be provided/, "$ut: failed on blank annotation");
|
||||
|
||||
# Attempt an annotation without ID
|
||||
$output = qx{echo "n" | ../src/task rc:bug.rc annotate bar 2>&1 >/dev/null};
|
||||
like ($output, qr/Command prevented from running/, 'Filter-less write command inhibited');
|
||||
$output = qx{echo "n" | ../src/task rc:$rc annotate bar 2>&1 >/dev/null};
|
||||
like ($output, qr/Command prevented from running/, "$ut: Filter-less write command inhibited");
|
||||
|
||||
$output = qx{echo "y" | ../src/task rc:bug.rc annotate bar 2>&1 >/dev/null};
|
||||
unlike ($output, qr/Command prevented from running/, 'Filter-less write command permitted');
|
||||
$output = qx{echo "y" | ../src/task rc:$rc annotate bar 2>&1 >/dev/null};
|
||||
unlike ($output, qr/Command prevented from running/, "$ut: Filter-less write command permitted");
|
||||
|
||||
# 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