mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Bug
- Fixed Bug #1060 where an error that was thrown by undo was not correctly caught and reported. - Added a couple of tests to ensure that the correct error was caught and reported.
This commit is contained in:
parent
bd085a820d
commit
d73766484d
2 changed files with 7 additions and 3 deletions
|
@ -48,7 +48,7 @@ int CmdUndo::execute (std::string& output)
|
|||
{
|
||||
// Detect attemps to modify the task.
|
||||
if (context.a3.extract_modifications ().size () > 0)
|
||||
throw STRING_CMD_UNDO_MODS;
|
||||
throw std::string (STRING_CMD_UNDO_MODS);
|
||||
|
||||
context.tdb2.revert ();
|
||||
context.tdb2.commit ();
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 9;
|
||||
use Test::More tests => 11;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'undo.rc')
|
||||
|
@ -56,6 +56,11 @@ like ($output, qr/Status\s+Pending\n/, 'Pending');
|
|||
$output = qx{../src/task rc:undo.rc 1 do 2>&1; ../src/task rc:undo.rc list 2>&1 >/dev/null};
|
||||
like ($output, qr/No matches/, 'No matches');
|
||||
|
||||
# Bug 1060: Test that if undo is given an argument it catches and reports the correct error.
|
||||
$output = qx{../src/task rc:undo.rc undo 1 2>&1};
|
||||
unlike ($output, qr/Unknown error/, 'No unknown error');
|
||||
like ($output, qr/The undo command does not allow further task modification/, 'Correct error caught and reported');
|
||||
|
||||
# Cleanup.
|
||||
unlink qw(pending.data completed.data undo.data backlog.data synch.key undo.rc);
|
||||
ok (! -r 'pending.data' &&
|
||||
|
@ -66,4 +71,3 @@ ok (! -r 'pending.data' &&
|
|||
! -r 'undo.rc', 'Cleanup');
|
||||
|
||||
exit 0;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue