From 5b2505f6da5f4a1756081146de4be45b43364d29 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 15 Jun 2014 09:30:46 -0400 Subject: [PATCH] Unit Tests - Tests now conform to template. --- test/uda_string.t | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/test/uda_string.t b/test/uda_string.t index 07c29122b..482b6d020 100755 --- a/test/uda_string.t +++ b/test/uda_string.t @@ -33,28 +33,32 @@ 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, '>', 'uda.rc') +if (open my $fh, '>', $rc) { print $fh "data.location=.\n", "confirmation=off\n", "uda.extra.type=string\n", "uda.extra.label=Extra\n", - "report.uda.description=UDA Test\n", - "report.uda.columns=id,extra,description\n", - "report.uda.sort=extra,description\n", - "report.uda.labels=ID,Extra,Description\n"; + "report.uuu.description=UDA Test\n", + "report.uuu.columns=id,extra,description\n", + "report.uuu.sort=extra,description\n", + "report.uuu.labels=ID,Extra,Description\n"; close $fh; } # Add tasks with and without the UDA. -qx{../src/task rc:uda.rc add with extra:"one two" 2>&1}; -qx{../src/task rc:uda.rc add without 2>&1}; -my $output = qx{../src/task rc:uda.rc uda 2>&1}; -like ($output, qr/1\s+one two\s+with/, 'UDA string stored'); -like ($output, qr/2\s+without/, 'UDA string blank'); +qx{../src/task rc:$rc add with extra:"one two" 2>&1}; +qx{../src/task rc:$rc add without 2>&1}; +my $output = qx{../src/task rc:$rc uuu 2>&1}; +like ($output, qr/1\s+one two\s+with/, "$ut: UDA string stored"); +like ($output, qr/2\s+without/, "$ut: UDA string blank"); # 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;