diff --git a/test/uda_defaults.t b/test/uda_defaults.t index 6828fc801..4e9283d7f 100755 --- a/test/uda_defaults.t +++ b/test/uda_defaults.t @@ -33,8 +33,12 @@ use Test::More tests => 6; 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, '>', 'uda.rc') +if (open my $fh, '>', $rc) { print $fh "data.location=.\n", "confirmation=off\n", @@ -52,23 +56,23 @@ if (open my $fh, '>', 'uda.rc') } # Add task with nondefault UDA -my $output = qx{../src/task rc:uda.rc add one smell:strong 2>&1}; -like ($output, qr/Created task 1/, 'Add 1 - no errors'); +my $output = qx{../src/task rc:$rc add one smell:strong 2>&1}; +like ($output, qr/Created task 1/, "$ut: Add 1 - no errors"); # Add task without a UDA value, checking for usage of the default -$output = qx{../src/task rc:uda.rc add two 2>&1}; -like ($output, qr/Created task 2/, 'Add 2 - no errors'); +$output = qx{../src/task rc:$rc add two 2>&1}; +like ($output, qr/Created task 2/, "$ut: Add 2 - no errors"); # Add a task with a UDA that has no default, ensure it is entered fine -$output = qx{../src/task rc:uda.rc add three size:10 2>&1}; -like ($output, qr/Created task 3/, 'Add 3 - no errors'); +$output = qx{../src/task rc:$rc add three size:10 2>&1}; +like ($output, qr/Created task 3/, "$ut: Add 3 - no errors"); -$output = qx{../src/task rc:uda.rc uda 2>&1}; -like ($output, qr/1\s+strong\s+one/, 'UDA nondefault stored'); -like ($output, qr/2\s+weak\s+two/, 'UDA default stored'); -like ($output, qr/3\s+weak\s+10\s+three/, 'UDA without default stored'); +$output = qx{../src/task rc:$rc uda 2>&1}; +like ($output, qr/1\s+strong\s+one/, "$ut: UDA nondefault stored"); +like ($output, qr/2\s+weak\s+two/, "$ut: UDA default stored"); +like ($output, qr/3\s+weak\s+10\s+three/, "$ut: UDA without default stored"); # Cleanup. -unlink qw(pending.data completed.data undo.data backlog.data uda.rc); +unlink qw(pending.data completed.data undo.data backlog.data), $rc; exit 0;