mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Bug 466
- Fixed #466, which gave the wrong error message when a custom report was missing a direction indicator for the sort order. - Added unit tests.
This commit is contained in:
parent
c7cd2d2619
commit
63384abd14
3 changed files with 71 additions and 0 deletions
|
@ -52,6 +52,8 @@
|
||||||
and overdue.
|
and overdue.
|
||||||
+ Fixed bug #459, which showed a confusing message when 'limit:page' was
|
+ Fixed bug #459, which showed a confusing message when 'limit:page' was
|
||||||
used, with few tasks.
|
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
|
+ Fixed problem with command line configuration overrides that had no
|
||||||
values.
|
values.
|
||||||
+ Fixed problem with the 'undo' command not observing the rc.color or the
|
+ Fixed problem with the 'undo' command not observing the rc.color or the
|
||||||
|
|
|
@ -730,6 +730,12 @@ void validSortColumns (
|
||||||
std::vector <std::string>::const_iterator sc;
|
std::vector <std::string>::const_iterator sc;
|
||||||
for (sc = sortColumns.begin (); sc != sortColumns.end (); ++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 <std::string>::const_iterator co;
|
std::vector <std::string>::const_iterator co;
|
||||||
for (co = columns.begin (); co != columns.end (); ++co)
|
for (co = columns.begin (); co != columns.end (); ++co)
|
||||||
if (sc->substr (0, sc->length () - 1) == *co)
|
if (sc->substr (0, sc->length () - 1) == *co)
|
||||||
|
|
63
src/tests/bug.466.t
Executable file
63
src/tests/bug.466.t
Executable file
|
@ -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;
|
Loading…
Add table
Add a link
Reference in a new issue