Unit Tests

- Fixed minor unit test problems.
This commit is contained in:
Paul Beckingham 2011-09-05 01:27:57 -04:00
parent 751e8e7f90
commit e2d0126415
4 changed files with 39 additions and 77 deletions

View file

@ -28,7 +28,7 @@
use strict;
use warnings;
use Test::More tests => 11;
use Test::More tests => 6;
# Create the rc file.
if (open my $fh, '>', 'bug.rc')
@ -65,23 +65,13 @@ $output = qx{../src/task rc:bug.rc $id modify due:};
unlike ($output, qr/You cannot remove the due date from a recurring task./ms, 'Can remove due date from a non-recurring task');
# Cleanup.
unlink 'pending.data';
ok (!-r 'pending.data', 'Removed pending.data');
unlink 'completed.data';
ok (!-r 'completed.data', 'Removed completed.data');
unlink 'undo.data';
ok (!-r 'undo.data', 'Removed undo.data');
unlink 'backlog.data';
ok (!-r 'backlog.data', 'Removed backlog.data');
unlink 'synch.key';
ok (!-r 'synch.key', 'Removed synch.key');
unlink 'bug.rc';
ok (!-r 'bug.rc', 'Removed bug.rc');
unlink qw(pending.data completed.data undo.data backlog.data synch.key bug.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'synch_key.data' &&
! -r 'bug.rc', 'Cleanup');
exit 0;

View file

@ -28,7 +28,7 @@
use strict;
use warnings;
use Test::More tests => 20;
use Test::More tests => 11;
use File::Copy;
use constant false => 0;
@ -73,47 +73,32 @@ my $output = qx{../src/task rc:remote.rc ls};
like ($output, qr/local task/, "autopush failed");
# Cleanup.
unlink 'local/pending.data';
ok (!-r 'local/pending.data', 'Removed local/pending.data');
unlink qw(local/pending.data local/completed.data local/undo.data local/undo.save local/backlog.data local/synch.key local.rc);
ok (! -r 'local/pending.data' &&
! -r 'local/completed.data' &&
! -r 'local/undo.data' &&
! -r 'local/undo.save' &&
! -r 'local/backlog.data' &&
! -r 'local/synch_key.data' &&
! -r 'local.rc', 'Cleanup');
unlink 'local/completed.data';
ok (!-r 'local/completed.data', 'Removed local/completed.data');
unlink qw(remote/pending.data remote/completed.data remote/undo.data remote/backlog.data remote/synch.key remote.rc);
ok (! -r 'remote/pending.data' &&
! -r 'remote/completed.data' &&
! -r 'remote/undo.data' &&
! -r 'remote/backlog.data' &&
! -r 'remote/synch_key.data' &&
! -r 'remote.rc', 'Cleanup');
unlink 'local/undo.data';
ok (!-r 'local/undo.data', 'Removed local/undo.data');
unlink 'local/undo.save';
ok (!-r 'local/undo.save', 'Removed local/undo.save');
unlink 'local/backlog.data';
ok (!-r 'local/backlog.data', 'Removed local/backlog.data');
unlink 'local/synch.key';
ok (!-r 'local/synch.key', 'Removed local/synch.key');
unlink 'local.rc';
ok (!-r 'local.rc', 'Removed local.rc');
unlink 'remote/pending.data';
ok (!-r 'remote/pending.data', 'Removed remote/pending.data');
unlink 'remote/completed.data';
ok (!-r 'remote/completed.data', 'Removed remote/completed.data');
unlink 'remote/undo.data';
ok (!-r 'remote/undo.data', 'Removed remote/undo.data');
unlink 'remote/backlog.data';
ok (!-r 'remote/backlog.data', 'Removed remote/backlog.data');
unlink 'remote/synch.key';
ok (!-r 'remote/synch.key', 'Removed remote/synch.key');
unlink 'remote.rc';
ok (!-r 'remote.rc', 'Removed remote.rc');
rmdir("remote/extensions");
ok (!-e "remote/extensions", "Removed dir remote/extensions");
rmdir("remote");
ok (!-e "remote", "Removed dir remote");
rmdir("local/extensions");
ok (!-e "local/extensions", "Removed dir local/extensions");
rmdir("local");
ok (!-e "local", "Removed dir local");

View file

@ -28,7 +28,7 @@
use strict;
use warnings;
use Test::More tests => 22;
use Test::More tests => 14;
# Create the rc file.
if (open my $fh, '>', 'delete.rc')
@ -71,26 +71,13 @@ like ($output, qr/foo/, 'Deletion annotation successful');
like ($output, qr/H/, 'Deletion modification successful');
# Cleanup.
ok (-r 'pending.data', 'Need to remove pending.data');
unlink 'pending.data';
ok (!-r 'pending.data', 'Removed pending.data');
ok (-r 'completed.data', 'Need to remove completed.data');
unlink 'completed.data';
ok (!-r 'completed.data', 'Removed completed.data');
ok (-r 'undo.data', 'Need to remove undo.data');
unlink 'undo.data';
ok (!-r 'undo.data', 'Removed undo.data');
unlink 'backlog.data';
ok (!-r 'backlog.data', 'Removed backlog.data');
unlink 'synch.key';
ok (!-r 'synch.key', 'Removed synch.key');
unlink 'delete.rc';
ok (!-r 'delete.rc', 'Removed delete.rc');
unlink qw(pending.data completed.data undo.data backlog.data synch.key delete.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'synch_key.data' &&
! -r 'delete.rc', 'Cleanup');
exit 0;

View file

@ -118,7 +118,7 @@ task:
EOF
close $fh;
ok (-r 'import2.txt', 'Created second sample import data');
ok (-r 'import.txt', 'Created second sample import data');
}
# Convert YAML --> task JSON.