From ce7f6b64922080e203be19e8f711cdc6e89deaad Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 24 Aug 2014 15:57:15 -0400 Subject: [PATCH] Unit Tests - Updated to use the new template. --- test/feature.exit.t | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/test/feature.exit.t b/test/feature.exit.t index e1a23ff34..082f79cb3 100755 --- a/test/feature.exit.t +++ b/test/feature.exit.t @@ -33,21 +33,25 @@ use Test::More tests => 2; 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, '>', 'exit.rc') +if (open my $fh, '>', $rc) { print $fh "data.location=.\n", "confirmation=no\n"; close $fh; } -qx{../src/task rc:exit.rc add foo 2>&1}; -my $exit_good = system ('../src/task rc:exit.rc ls /foo/ >/dev/null 2>&1') >> 8; -is ($exit_good, 0, 'task returns 0 on success'); -my $exit_bad = system ('../src/task rc:exit.rc ls /bar/ >/dev/null 2>&1') >> 8; -isnt ($exit_bad, 0, 'task returns non-zero on failure'); +qx{../src/task rc:$rc add foo 2>&1}; +my $exit_good = system ("../src/task rc:$rc ls /foo/ >/dev/null 2>&1") >> 8; +is ($exit_good, 0, "$ut: task returns 0 on success"); +my $exit_bad = system ("../src/task rc:$rc ls /bar/ >/dev/null 2>&1") >> 8; +isnt ($exit_bad, 0, "$ut: task returns non-zero on failure"); # Cleanup. -unlink qw(pending.data completed.data undo.data backlog.data exit.rc); +unlink qw(pending.data completed.data undo.data backlog.data), $rc; exit 0;