Feature #1256 Follow-up

- Extended unit tests to cover 'add' failures.
- Removed whitespace at EOL.
- Updated ChangeLog, AUTHORS, NEWS.
- Updated taskrc.5.in.
- Updated CmdShow to allow new config settings.
This commit is contained in:
Paul Beckingham 2013-05-07 16:20:47 -04:00
parent 56eab7da0d
commit 157699cbde
8 changed files with 33 additions and 18 deletions

View file

@ -86,6 +86,7 @@ The following submitted code, packages or analysis, and deserve special thanks:
Russell Steicke
YBSAR
Tullio Facchinetti
Thomas Sullivan
Thanks to the following, who submitted detailed bug reports and excellent
suggestions:

View file

@ -11,6 +11,7 @@ Features
+ #1227 A new 'verify_l10n' utility ensures the localizations are in sync (thanks to
Wim Schuermann).
+ #1250 Support out-of-tree test runs (thanks to Jakub Wilk).
+ #1256 Supports default values for UDA fields (thanks to Thomas Sullivan).
+ Stores un-synched transactions in <data.location>/backlog.data.
+ Adds a new 'synchronize' command to sync data with a task server.
+ Adds a new 'sync' verbosity token, which will reminds when a backlog builds

1
NEWS
View file

@ -5,6 +5,7 @@ New Features in taskwarrior 2.3.0
- New shell with Readline support.
- The 'dateformat' settings now default to the ISO-8601 standard of 'Y-M-D'.
- Italian translation.
- UDA fields now allow default values.
New commands in taskwarrior 2.3.0

View file

@ -1139,6 +1139,13 @@ Provides a default due date for the
.I task add
command, if you don't specify one. The default is blank.
.TP
.B
uda.<name>.default=...
Provides default values for UDA fields when using the
.I task add
command, if you don't specify values. The default is blank.
.TP
.B
default.command=next

View file

@ -1262,9 +1262,10 @@ void Task::validate (bool applyDefault /* = true */)
}
// If a UDA has a default value in the configuration,
// override with uda.(uda).default, if not specified
// override with uda.(uda).default, if not specified.
if (applyDefault)
{ // Gather a list of all UDAs with a .default value
{
// Gather a list of all UDAs with a .default value
std::vector <std::string> names;
context.config.all (names);
@ -1282,7 +1283,8 @@ void Task::validate (bool applyDefault /* = true */)
}
if (udas.size ())
{ // For each of those, setup the default value on the task now,
{
// For each of those, setup the default value on the task now,
// of course only if we don't have one on the command line already
std::vector <std::string>::iterator uda;
for (uda = udas.begin (); uda != udas.end (); ++uda)
@ -1292,12 +1294,11 @@ void Task::validate (bool applyDefault /* = true */)
// If the default is empty, and we already have a value, skip it
if (defVal != "" && get (*uda) == "")
set(*uda,defVal);
set (*uda, defVal);
}
}
}
// 2) To provide suitable warnings about odd states
// Date relationships.

View file

@ -238,6 +238,7 @@ int CmdShow::execute (std::string& output)
i->substr (0, 5) != "pull." &&
i->substr (0, 6) != "merge." &&
i->substr (0, 4) != "uda." &&
i->substr (0, 4) != "default." &&
i->substr (0, 21) != "urgency.user.project." &&
i->substr (0, 17) != "urgency.user.tag." &&
i->substr (0, 12) != "urgency.uda.")

View file

@ -28,7 +28,7 @@
use strict;
use warnings;
use Test::More tests => 5;
use Test::More tests => 8;
# Create the rc file.
if (open my $fh, '>', 'uda.rc')
@ -50,15 +50,18 @@ if (open my $fh, '>', 'uda.rc')
}
# Add task with nondefault UDA
qx{../src/task rc:uda.rc add one smell:strong 2>&1};
my $output = qx{../src/task rc:uda.rc add one smell:strong 2>&1};
like ($output, qr/Created task 1/, 'Add 1 - no errors');
# Add task without a UDA value, checking for usage of the default
qx{../src/task rc:uda.rc add two 2>&1};
$output = qx{../src/task rc:uda.rc add two 2>&1};
like ($output, qr/Created task 2/, 'Add 2 - no errors');
# Add a task with a UDA that has no default, ensure it is entered fine
qx{../src/task rc:uda.rc add three size:10 2>&1};
$output = qx{../src/task rc:uda.rc add three size:10 2>&1};
like ($output, qr/Created task 3/, 'Add 3 - no errors');
my $output = qx{../src/task rc:uda.rc uda 2>&1};
$output = qx{../src/task rc:uda.rc uda 2>&1};
like ($output, qr/1\s+strong\s+one/, 'UDA nondefault stored');
like ($output, qr/2\s+weak\s+two/, 'UDA default stored');
like ($output, qr/3\s+weak\s+10\s+three/, 'UDA without default stored');