Unit Tests
- Added more undo tests, to cover both cases for backlog rollback.
This commit is contained in:
11
test/undo.t
11
test/undo.t
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Test::More tests => 16;
|
use Test::More tests => 20;
|
||||||
|
|
||||||
# Ensure environment has no influence.
|
# Ensure environment has no influence.
|
||||||
delete $ENV{'TASKDATA'};
|
delete $ENV{'TASKDATA'};
|
||||||
@@ -65,6 +65,15 @@ $output = qx{../src/task rc:undo.rc undo 1 2>&1};
|
|||||||
unlike ($output, qr/Unknown error/, 'No unknown error');
|
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');
|
like ($output, qr/The undo command does not allow further task modification/, 'Correct error caught and reported');
|
||||||
|
|
||||||
|
# Add a new task and undo it.
|
||||||
|
$output = qx{../src/task rc:undo.rc add two 2>&1; ../src/task rc:undo.rc info 1 2>&1};
|
||||||
|
unlike ($output, qr/Unknown error/, 'No unknown error');
|
||||||
|
like ($output, qr/Status\s+Pending\n/, 'Pending');
|
||||||
|
|
||||||
|
$output = qx{../src/task rc:undo.rc undo 2>&1; ../src/task rc:undo.rc info 1 2>&1};
|
||||||
|
like ($output, qr/Task removed\.\n/, 'Task removed');
|
||||||
|
like ($output, qr/No matches\.\n/, 'No matches');
|
||||||
|
|
||||||
# Inspect backlog.data
|
# Inspect backlog.data
|
||||||
if (open my $fh, '<', 'backlog.data')
|
if (open my $fh, '<', 'backlog.data')
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user