mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Unit Tests - Complete Att unit tests
- Covers parsing, composition.
This commit is contained in:
parent
ed685a55ce
commit
766c2d3620
3 changed files with 61 additions and 36 deletions
12
src/Att.cpp
12
src/Att.cpp
|
@ -100,6 +100,9 @@ bool Att::parse (Nibbler& n)
|
|||
|
||||
if (n.getUntilOneOf (".:", mName))
|
||||
{
|
||||
if (mName.length () == 0)
|
||||
throw std::string ("Missing attribute name");
|
||||
|
||||
while (n.skip ('.'))
|
||||
{
|
||||
std::string mod;
|
||||
|
@ -113,8 +116,15 @@ bool Att::parse (Nibbler& n)
|
|||
{
|
||||
if (n.getQuoted ('"', mValue))
|
||||
return true;
|
||||
else if (n.getUntil (' ', mValue))
|
||||
|
||||
// This is here to tolerate unquoted values.
|
||||
// Consider removing this for a stricter parse.
|
||||
if (n.getUntil (' ', mValue))
|
||||
{
|
||||
dequote (mValue);
|
||||
decode (mValue);
|
||||
return true;
|
||||
}
|
||||
|
||||
throw std::string ("Missing attribute value");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue