Unit Tests

- Removed obsolete tests.
This commit is contained in:
Paul Beckingham 2014-06-11 06:31:33 -04:00
parent a76614aabb
commit ccc0fa7c30

View file

@ -27,39 +27,36 @@
use strict;
use warnings;
use Test::More tests => 4;
use Test::More tests => 2;
# Ensure environment has no influence.
delete $ENV{'TASKDATA'};
delete $ENV{'TASKRC'};
use File::Basename;
my $ut = basename ($0);
my $rc = $ut . '.rc';
# Create the rc file.
if (open my $fh, '>', 'completed.rc')
if (open my $fh, '>', $rc)
{
print $fh "data.location=.\n",
"confirmation=no\n";
"confirmation=off\n";
close $fh;
ok (-r 'completed.rc', 'Created completed.rc');
}
# Add two tasks, mark 1 as done, the other as deleted.
qx{../src/task rc:completed.rc add one 2>&1};
qx{../src/task rc:completed.rc add two 2>&1};
qx{../src/task rc:completed.rc 1 done 2>&1};
qx{../src/task rc:completed.rc 2 delete 2>&1};
qx{../src/task rc:$rc add one 2>&1};
qx{../src/task rc:$rc add two 2>&1};
qx{../src/task rc:$rc 1 done 2>&1};
qx{../src/task rc:$rc 2 delete 2>&1};
# Generate completed report.
my $output = qx{../src/task rc:completed.rc completed 2>&1};
my $output = qx{../src/task rc:$rc completed 2>&1};
like ($output, qr/one/, 'one -> completed');
unlike ($output, qr/two/, 'two -> deleted');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data completed.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'completed.rc', 'Cleanup');
unlink qw(pending.data completed.data undo.data backlog.data), $rc;
exit 0;