From 5f61c55b83e6fb9ef625bcc9421ea1f40073f3df Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 16 Jun 2014 21:44:30 -0400 Subject: [PATCH] Unit Tests - Corrected tests to use 3-letter day abbreviation, and look for the correct error message. - Updated to conform to template. --- test/bug.886.t | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/test/bug.886.t b/test/bug.886.t index 6260fd158..6cda508d0 100755 --- a/test/bug.886.t +++ b/test/bug.886.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, '>', 'bug.rc') +if (open my $fh, '>', $rc) { print $fh "data.location=.\n"; close $fh; } # Bug 886: tw doesn't warn the user if, e.g., a weekday cannot be resolved properly -my $output = qx{../src/task rc:bug.rc add one due:sund 2>&1}; -like ($output, qr/Created task 1\./, 'sund --> valid date'); +my $output = qx{../src/task rc:$rc add one due:sun 2>&1}; +like ($output, qr/Created task 1\./, "$ut: sun --> valid date"); -$output = qx{../src/task rc:bug.rc add two due:donkey 2>&1 >/dev/null}; -like ($output, qr/was not recognized/, 'donkey --> invalid date'); +$output = qx{../src/task rc:$rc add two due:donkey 2>&1}; +like ($output, qr/is not a valid date/, "$ut: donkey --> is not a valid date"); # 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;