mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Bug Fixes - Att, Subst
- Fixed but that required all known attributes to be listed by name in order to be recognized by creating new Att::validInternalName method. - Fixed bug in non-global Subst that failed to save a modified annotation.
This commit is contained in:
parent
cea84b3d3b
commit
3ffb855956
4 changed files with 16 additions and 23 deletions
35
src/Att.cpp
35
src/Att.cpp
|
@ -187,6 +187,16 @@ bool Att::valid (const std::string& input) const
|
|||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Att::validInternalName (const std::string& name)
|
||||
{
|
||||
for (unsigned int i = 0; i < NUM_INTERNAL_NAMES; ++i)
|
||||
if (name == internalNames[i])
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Att::validModifiableName (const std::string& name)
|
||||
{
|
||||
|
@ -206,19 +216,7 @@ bool Att::validNameValue (
|
|||
std::string writableName = name;
|
||||
std::string writableMod = mod;
|
||||
std::string writableValue = value;
|
||||
bool status = Att::validNameValue (writableName, writableMod, writableValue);
|
||||
/*
|
||||
// TODO Is this even worth doing?
|
||||
if (name != writableName)
|
||||
throw std::string ("The attribute '") + name + "' was not fully qualified.";
|
||||
|
||||
if (mod != writableMod)
|
||||
throw std::string ("The modifier '") + mod + "' was not fully qualified.";
|
||||
|
||||
if (value != writableValue)
|
||||
throw std::string ("The value '") + value + "' was not fully qualified.";
|
||||
*/
|
||||
return status;
|
||||
return Att::validNameValue (writableName, writableMod, writableValue);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -369,15 +367,8 @@ bool Att::validNameValue (
|
|||
"\" is not a valid status. Use 'pending', 'completed', 'deleted' or 'recurring'.";
|
||||
}
|
||||
|
||||
else if (name == "parent")
|
||||
{
|
||||
}
|
||||
|
||||
else if (name == "uuid")
|
||||
{
|
||||
}
|
||||
|
||||
else
|
||||
else if (! validInternalName (name) &&
|
||||
! validModifiableName (name))
|
||||
throw std::string ("'") + name + "' is not a recognized attribute.";
|
||||
|
||||
return true;
|
||||
|
|
|
@ -44,6 +44,7 @@ public:
|
|||
~Att ();
|
||||
|
||||
bool valid (const std::string&) const;
|
||||
static bool validInternalName (const std::string&);
|
||||
static bool validModifiableName (const std::string&);
|
||||
static bool validNameValue (const std::string&, const std::string&, const std::string&);
|
||||
static bool validNameValue (std::string&, std::string&, std::string&);
|
||||
|
|
|
@ -158,6 +158,7 @@ void Subst::apply (
|
|||
if ((pattern = description.find (mFrom)) != std::string::npos)
|
||||
{
|
||||
description.replace (pattern, mFrom.length (), mTo);
|
||||
i->value (description);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ $output = qx{../task rc:sp.rc list project:abc};
|
|||
like ($output, qr/\babc\s*$/m, 'abc,ab,a,b | a -> abc');
|
||||
|
||||
$output = qx{../task rc:sp.rc list project:abcd};
|
||||
like ($output, qr/^No matches.$/, 'abc,ab,a,b | abcd -> nul');
|
||||
like ($output, qr/No matches./, 'abc,ab,a,b | abcd -> nul');
|
||||
|
||||
# Cleanup.
|
||||
unlink 'pending.data';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue