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
959d59d48d
commit
353a972802
1 changed files with 10 additions and 6 deletions
|
@ -33,8 +33,12 @@ use Test::More tests => 2;
|
|||
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";
|
||||
|
@ -44,14 +48,14 @@ if (open my $fh, '>', 'bug.rc')
|
|||
# Bug 634: confirmation=off not honored by undo
|
||||
|
||||
# Setup: Add a task
|
||||
qx{../src/task rc:bug.rc add Test 2>&1};
|
||||
qx{../src/task rc:$rc add Test 2>&1};
|
||||
|
||||
# Result: Attempt to undo add with confirmation=off
|
||||
my $output = qx{echo 'n' | ../src/task rc:bug.rc rc.confirmation=off undo 2>&1};
|
||||
like ($output, qr/^Task removed.$/ms, 'Task removed.');
|
||||
unlike ($output, qr/Are you sure/ms, 'Undo honours confirmation=off.');
|
||||
my $output = qx{echo 'n' | ../src/task rc:$rc rc.confirmation=off undo 2>&1};
|
||||
like ($output, qr/^Task removed.$/ms, "$ut: Task removed.");
|
||||
unlike ($output, qr/Are you sure/ms, "$ut: Undo honors confirmation=off.");
|
||||
|
||||
# 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