Unit Tests

- Upgraded to use the new template.
This commit is contained in:
Paul Beckingham 2014-08-24 21:41:45 -04:00
parent 7488d464fc
commit 333fd945f6

View file

@ -33,8 +33,12 @@ use Test::More tests => 3;
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, '>', 'bug.rc')
if (open my $fh, '>', $rc)
{
print $fh "data.location=.\n",
"confirmation=off\n";
@ -45,12 +49,12 @@ if (open my $fh, '>', 'bug.rc')
# - showing the list of default configuration variables
# - checking that there is no error, no deprecated variable and no unrecognized variables
qx{../src/task rc:bug.rc add foo 2>&1};
my $output = qx{../src/task rc:bug.rc show 2>&1};
like ($output, qr/^Config Variable\s+Value$/m, 'Variables shown');
unlike ($output, qr/Configuration error/ms, 'No configuration error');
unlike ($output, qr/unrecognized/ms, 'No unrecognized variable');
qx{../src/task rc:$rc add foo 2>&1};
my $output = qx{../src/task rc:$rc show 2>&1};
like ($output, qr/^Config Variable\s+Value$/m, "$ut: Variables shown");
unlike ($output, qr/Configuration error/ms, "$ut: No configuration error");
unlike ($output, qr/unrecognized/ms, "$ut: No unrecognized variable");
## Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data bug.rc);
unlink qw(pending.data completed.data undo.data backlog.data), $rc;
exit 0;