Unit Tests

- Removed obsolete tests.
This commit is contained in:
Paul Beckingham 2014-06-11 06:37:37 -04:00
parent f7a68df299
commit 699d85be29
2 changed files with 20 additions and 12 deletions

View file

@ -27,16 +27,21 @@
use strict; use strict;
use warnings; use warnings;
use Test::More tests => 4; use Test::More tests => 3;
# Ensure environment has no influence. # Ensure environment has no influence.
delete $ENV{'TASKDATA'}; delete $ENV{'TASKDATA'};
delete $ENV{'TASKRC'}; delete $ENV{'TASKRC'};
use File::Basename;
my $ut = basename ($0);
my $rc = $ut . '.rc';
# Create the rc file. # Create the rc file.
if (open my $fh, '>', 'time.rc') if (open my $fh, '>', $rc)
{ {
print $fh "data.location=.\n"; print $fh "data.location=.\n",
"confirmation=off\n";
close $fh; close $fh;
} }
@ -61,14 +66,13 @@ if (open my $fh, '>', 'pending.data')
[status:"completed" description:"CNN2" entry:"$now" end:"$now"] [status:"completed" description:"CNN2" entry:"$now" end:"$now"]
EOF EOF
close $fh; close $fh;
ok (-r 'pending.data', 'Created pending.data');
} }
my $output = qx{../src/task rc:time.rc history.annual 2>&1}; my $output = qx{../src/task rc:$rc history.annual 2>&1};
like ($output, qr/7\s+1\s+0\s+6/, 'history.annual - last year'); like ($output, qr/7\s+1\s+0\s+6/, 'history.annual - last year');
like ($output, qr/2\s+3\s+3\s+-4/, 'history.annual - this year'); like ($output, qr/2\s+3\s+3\s+-4/, 'history.annual - this year');
like ($output, qr/4\s+2\s+1\s+1/, 'history.annual - average'); like ($output, qr/4\s+2\s+1\s+1/, 'history.annual - average');
# Cleanup. # Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data time.rc); unlink qw(pending.data completed.data undo.data backlog.data), $rc;
exit 0; exit 0;

View file

@ -27,16 +27,21 @@
use strict; use strict;
use warnings; use warnings;
use Test::More tests => 4; use Test::More tests => 3;
# Ensure environment has no influence. # Ensure environment has no influence.
delete $ENV{'TASKDATA'}; delete $ENV{'TASKDATA'};
delete $ENV{'TASKRC'}; delete $ENV{'TASKRC'};
use File::Basename;
my $ut = basename ($0);
my $rc = $ut . '.rc';
# Create the rc file. # Create the rc file.
if (open my $fh, '>', 'time.rc') if (open my $fh, '>', $rc)
{ {
print $fh "data.location=.\n"; print $fh "data.location=.\n",
"confirmation=off\n";
close $fh; close $fh;
} }
@ -61,14 +66,13 @@ if (open my $fh, '>', 'pending.data')
[status:"completed" description:"CNN2" entry:"$now" end:"$now"] [status:"completed" description:"CNN2" entry:"$now" end:"$now"]
EOF EOF
close $fh; close $fh;
ok (-r 'pending.data', 'Created pending.data');
} }
my $output = qx{../src/task rc:time.rc history.monthly 2>&1}; my $output = qx{../src/task rc:$rc history.monthly 2>&1};
like ($output, qr/7\s+1\s+0\s+6/, 'history.monthly - last month'); like ($output, qr/7\s+1\s+0\s+6/, 'history.monthly - last month');
like ($output, qr/2\s+3\s+3\s+-4/, 'history.monthly - this month'); like ($output, qr/2\s+3\s+3\s+-4/, 'history.monthly - this month');
like ($output, qr/4\s+2\s+1\s+1/, 'history.monthly - average'); like ($output, qr/4\s+2\s+1\s+1/, 'history.monthly - average');
# Cleanup. # Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data time.rc); unlink qw(pending.data completed.data undo.data backlog.data), $rc;
exit 0; exit 0;