diff --git a/ChangeLog b/ChangeLog index 8c4283130..ce0bd42f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -244,6 +244,8 @@ + Fixed bug #862, which suppressed feedback from the 'denotate' command. + Fixed bug #863, which suppressed report labels with rc.verbose=off (thanks to Michelle Crane). + + Fixed bugs #865 and #886, which caused silent failure of unrecognized dates + (thanks to Michelle Crane). + Fixed bug #879, which mis-parsed escaped characters in the data file (thanks to Michelle Crane). + Fixed bug #880, which listed the wrong file paths for themes (thanks to Peter diff --git a/src/E9.cpp b/src/E9.cpp index 41c544b26..3a9e42dad 100644 --- a/src/E9.cpp +++ b/src/E9.cpp @@ -168,25 +168,26 @@ void E9::eval (const Task& task, std::vector & value_stack) if (operand._category == Arg::cat_dom && _dom) { + operand._category = Arg::cat_literal; operand._value = context.dom.get (operand._raw, task); - operand._category = Arg::cat_literal; } - else if (operand._type == Arg::type_date && - operand._category == Arg::cat_literal) + else if (operand._type == Arg::type_date) { - operand._value = Date (operand._raw, _dateformat).toEpochString (); operand._category = Arg::cat_literal; + operand._value = (operand._raw != "") + ? Date (operand._raw, _dateformat).toEpochString () + : ""; } - else if (operand._type == Arg::type_duration && - operand._category == Arg::cat_literal) + else if (operand._type == Arg::type_duration) { - operand._value = (std::string)Duration (operand._raw); operand._category = Arg::cat_literal; + operand._value = (operand._raw != "") + ? (std::string)Duration (operand._raw) + : ""; } else operand._value = operand._raw; - // std::cout << "# E9::eval operand " << operand << "\n"; value_stack.push_back (operand); } } diff --git a/test/bug.886.t b/test/bug.886.t new file mode 100755 index 000000000..35a114e27 --- /dev/null +++ b/test/bug.886.t @@ -0,0 +1,58 @@ +#! /usr/bin/perl +################################################################################ +## taskwarrior - a command line task list manager. +## +## Copyright 2006-2012, Paul Beckingham, Federico Hernandez. +## +## Permission is hereby granted, free of charge, to any person obtaining a copy +## of this software and associated documentation files (the "Software"), to deal +## in the Software without restriction, including without limitation the rights +## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +## copies of the Software, and to permit persons to whom the Software is +## furnished to do so, subject to the following conditions: +## +## The above copyright notice and this permission notice shall be included +## in all copies or substantial portions of the Software. +## +## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +## SOFTWARE. +## +## http://www.opensource.org/licenses/mit-license.php +## +################################################################################ + +use strict; +use warnings; +use Test::More tests => 4; + +# Create the rc file. +if (open my $fh, '>', 'bug.rc') +{ + print $fh "data.location=.\n"; + close $fh; + ok (-r 'bug.rc', 'Created bug.rc'); +} + +# 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}; +like ($output, qr/Created task 1\./, 'sund --> valid date'); + +$output = qx{../src/task rc:bug.rc add two due:donkey}; +like ($output, qr/was not recognized\./, 'donkey --> invalid date'); + +# Cleanup. +unlink qw(pending.data completed.data undo.data backlog.data synch.key bug.rc); +ok (! -r 'pending.data' && + ! -r 'completed.data' && + ! -r 'undo.data' && + ! -r 'backlog.data' && + ! -r 'synch.key' && + ! -r 'bug.rc', 'Cleanup'); + +exit 0; +