Documentation
- Cleaned up obsolete references.
This commit is contained in:
28
test/undo.t
28
test/undo.t
@@ -28,7 +28,7 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 11;
|
||||
use Test::More tests => 16;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
@@ -44,12 +44,12 @@ if (open my $fh, '>', 'undo.rc')
|
||||
ok (-r 'undo.rc', 'Created undo.rc');
|
||||
}
|
||||
|
||||
# Test the add/do/undo commands.
|
||||
# Test the add/done/undo commands.
|
||||
my $output = qx{../src/task rc:undo.rc add one 2>&1; ../src/task rc:undo.rc info 1 2>&1};
|
||||
ok (-r 'pending.data', 'pending.data created');
|
||||
like ($output, qr/Status\s+Pending\n/, 'Pending');
|
||||
|
||||
$output = qx{../src/task rc:undo.rc 1 do 2>&1; ../src/task rc:undo.rc info 1 2>&1};
|
||||
$output = qx{../src/task rc:undo.rc 1 done 2>&1; ../src/task rc:undo.rc info 1 2>&1};
|
||||
ok (-r 'completed.data', 'completed.data created');
|
||||
like ($output, qr/Status\s+Completed\n/, 'Completed');
|
||||
|
||||
@@ -65,6 +65,28 @@ $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');
|
||||
|
||||
# Inspect backlog.data
|
||||
if (open my $fh, '<', 'backlog.data')
|
||||
{
|
||||
my @lines = <$fh>;
|
||||
close $fh;
|
||||
|
||||
diag ($_) for @lines;
|
||||
is (scalar (@lines), 4, '4 lines of backlog');
|
||||
ok (index ($lines[0], '"status":"pending"') != -1, '[0] pending');
|
||||
ok (index ($lines[1], '"status":"completed"') != -1, '[1] completed');
|
||||
ok (index ($lines[2], '"status":"pending"') != -1, '[2] pending');
|
||||
ok (index ($lines[3], '"status":"completed"') != -1, '[3] completed');
|
||||
}
|
||||
else
|
||||
{
|
||||
fail ('4 lines of backlog');
|
||||
fail ('[0] pending');
|
||||
fail ('[1] completed');
|
||||
fail ('[2] pending');
|
||||
fail ('[3] completed');
|
||||
}
|
||||
|
||||
# Cleanup.
|
||||
unlink qw(pending.data completed.data undo.data backlog.data undo.rc);
|
||||
ok (! -r 'pending.data' &&
|
||||
|
||||
Reference in New Issue
Block a user