Unit Tests

- The unit tests needed a little love after "undelete" went away, and
  "undo" changed.
- Fixed a few tests that were broken.
This commit is contained in:
Paul Beckingham
2009-07-03 00:51:25 -04:00
parent 367214c57a
commit ef7c5dc4eb
9 changed files with 37 additions and 50 deletions

View File

@@ -28,38 +28,35 @@
use strict;
use warnings;
use Test::More tests => 18;
use Test::More tests => 17;
# Create the rc file.
if (open my $fh, '>', 'undelete.rc')
if (open my $fh, '>', 'delete.rc')
{
print $fh "data.location=.\n",
"echo.command=no\n";
close $fh;
ok (-r 'undelete.rc', 'Created undelete.rc');
ok (-r 'delete.rc', 'Created delete.rc');
}
# Add a task, delete it, undelete it.
my $output = qx{../task rc:undelete.rc add one; ../task rc:undelete.rc info 1};
my $output = qx{../task rc:delete.rc add one; ../task rc:delete.rc info 1};
ok (-r 'pending.data', 'pending.data created');
like ($output, qr/Status\s+Pending\n/, 'Pending');
$output = qx{../task rc:undelete.rc delete 1; ../task rc:undelete.rc info 1};
$output = qx{../task rc:delete.rc delete 1; ../task rc:delete.rc info 1};
like ($output, qr/Status\s+Deleted\n/, 'Deleted');
ok (-r 'completed.data', 'completed.data created');
$output = qx{../task rc:undelete.rc undelete 1; ../task rc:undelete.rc info 1};
$output = qx{echo 'y' | ../task rc:delete.rc undo; ../task rc:delete.rc info 1};
like ($output, qr/Status\s+Pending\n/, 'Pending');
ok (-r 'completed.data', 'completed.data created');
$output = qx{../task rc:undelete.rc delete 1; ../task rc:undelete.rc list};
$output = qx{../task rc:delete.rc delete 1; ../task rc:delete.rc list};
like ($output, qr/No matches./, 'No matches');
ok (-r 'completed.data', 'completed.data created');
$output = qx{../task rc:undelete.rc undelete 1};
like ($output, qr/Task 1 not found/, 'Task 1 not found');
$output = qx{../task rc:undelete.rc info 1};
$output = qx{../task rc:delete.rc info 1};
like ($output, qr/Task 1 not found/, 'No matches');
# Cleanup.
@@ -75,8 +72,8 @@ ok (-r 'undo.data', 'Need to remove undo.data');
unlink 'undo.data';
ok (!-r 'undo.data', 'Removed undo.data');
unlink 'undelete.rc';
ok (!-r 'undelete.rc', 'Removed undelete.rc');
unlink 'delete.rc';
ok (!-r 'delete.rc', 'Removed delete.rc');
exit 0;