diff --git a/ChangeLog b/ChangeLog index 2e7bf80b6..25204f52a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -52,6 +52,8 @@ and overdue. + Fixed bug #459, which showed a confusing message when 'limit:page' was used, with few tasks. + + Fixed bug #466, which gave the wrong error message when a custom report + was missing a direction indicator for the sort order. + Fixed problem with command line configuration overrides that had no values. + Fixed problem with the 'undo' command not observing the rc.color or the diff --git a/src/custom.cpp b/src/custom.cpp index 5917564e8..33aba2361 100644 --- a/src/custom.cpp +++ b/src/custom.cpp @@ -730,6 +730,12 @@ void validSortColumns ( std::vector ::const_iterator sc; for (sc = sortColumns.begin (); sc != sortColumns.end (); ++sc) { + char direction = (*sc)[sc->length () - 1]; + if (direction != '-' && direction != '+') + throw std::string ("Sort column '") + + *sc + + "' does not have a +/- ascending/descending indicator."; + std::vector ::const_iterator co; for (co = columns.begin (); co != columns.end (); ++co) if (sc->substr (0, sc->length () - 1) == *co) diff --git a/src/tests/bug.466.t b/src/tests/bug.466.t new file mode 100755 index 000000000..94d48ad95 --- /dev/null +++ b/src/tests/bug.466.t @@ -0,0 +1,63 @@ +#! /usr/bin/perl +################################################################################ +## task - a command line task list manager. +## +## Copyright 2006 - 2010, Paul Beckingham. +## All rights reserved. +## +## This program is free software; you can redistribute it and/or modify it under +## the terms of the GNU General Public License as published by the Free Software +## Foundation; either version 2 of the License, or (at your option) any later +## version. +## +## This program is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +## details. +## +## You should have received a copy of the GNU General Public License along with +## this program; if not, write to the +## +## Free Software Foundation, Inc., +## 51 Franklin Street, Fifth Floor, +## Boston, MA +## 02110-1301 +## USA +## +################################################################################ + +use strict; +use warnings; +use Test::More tests => 6; + +# Create the rc file. +if (open my $fh, '>', '466.rc') +{ + print $fh "data.location=.\n", + "report.foo.description=DESC\n", + "report.foo.columns=id,description\n", + "report.foo.sort=id,description\n"; + + close $fh; + ok (-r '466.rc', 'Created 466.rc'); +} + +# Bug #466 - wrong error message when sort key missing +/- +my $output = qx{../task rc:466.rc foo}; +like ($output, qr/Sort column 'id' does not have a \+\/- ascending\/descending indicator\./, + 'Error on missing sort direction'); + +# Cleanup. +unlink 'pending.data'; +ok (!-r 'pending.data', 'Removed pending.data'); + +unlink 'completed.data'; +ok (!-r 'completed.data', 'Removed completed.data'); + +unlink 'undo.data'; +ok (!-r 'undo.data', 'Removed undo.data'); + +unlink '466.rc'; +ok (!-r '466.rc', 'Removed 466.rc'); + +exit 0;