Unit Tests - Complete Att unit tests

- Covers parsing, composition.
This commit is contained in:
Paul Beckingham 2009-05-31 00:10:35 -04:00
parent ed685a55ce
commit 766c2d3620
3 changed files with 61 additions and 36 deletions

View file

@ -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");
}