From 5c194f484785989f5a2d2f4d4765cb49083bfd46 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 24 Aug 2014 21:23:55 -0400 Subject: [PATCH] Unit Tests - Upgraded to use the new template. --- test/bug.879.t | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/test/bug.879.t b/test/bug.879.t index 6797ea243..c9cbb0866 100755 --- a/test/bug.879.t +++ b/test/bug.879.t @@ -33,30 +33,34 @@ 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, '>', 'bug.rc') +if (open my $fh, '>', $rc) { print $fh "data.location=.\n"; close $fh; } # Bug 879: Backslash at end of description/annotation causes problems. -qx{../src/task rc:bug.rc add one\\\\ 2>&1}; -my $output = qx{../src/task rc:bug.rc long 2>&1}; -like ($output, qr/one\\/, 'Backslash preserved in description'); +qx{../src/task rc:$rc add one\\\\ 2>&1}; +my $output = qx{../src/task rc:$rc long 2>&1}; +like ($output, qr/one\\/, "$ut: Backslash preserved in description"); -qx{../src/task rc:bug.rc 1 annotate foo\\\\ 2>&1}; -$output = qx{../src/task rc:bug.rc long 2>&1}; -like ($output, qr/one\\/, 'Backslash preserved in description'); -like ($output, qr/foo\\/, 'Backslash preserved in annotation 1'); +qx{../src/task rc:$rc 1 annotate foo\\\\ 2>&1}; +$output = qx{../src/task rc:$rc long 2>&1}; +like ($output, qr/one\\/, "$ut: Backslash preserved in description"); +like ($output, qr/foo\\/, "$ut: Backslash preserved in annotation 1"); -qx{../src/task rc:bug.rc 1 annotate bar\\\\ 2>&1}; -$output = qx{../src/task rc:bug.rc long 2>&1}; -like ($output, qr/one\\/, 'Backslash preserved in description'); -like ($output, qr/foo\\/, 'Backslash preserved in annotation 1'); -like ($output, qr/bar\\/, 'Backslash preserved in annotation 2'); +qx{../src/task rc:$rc 1 annotate bar\\\\ 2>&1}; +$output = qx{../src/task rc:$rc long 2>&1}; +like ($output, qr/one\\/, "$ut: Backslash preserved in description"); +like ($output, qr/foo\\/, "$ut: Backslash preserved in annotation 1"); +like ($output, qr/bar\\/, "$ut: Backslash preserved in annotation 2"); # 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;