mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Unit Tests - Att
- Merged all old Mod tests into Att. - Fixed broken tests.
This commit is contained in:
parent
55771cc999
commit
f295fdf78f
2 changed files with 12 additions and 9 deletions
12
src/Att.cpp
12
src/Att.cpp
|
@ -107,7 +107,12 @@ bool Att::parse (Nibbler& n)
|
|||
{
|
||||
std::string mod;
|
||||
if (n.getUntilOneOf (".:", mod))
|
||||
mMods.push_back (mod);
|
||||
{
|
||||
if (validMod (mod))
|
||||
mMods.push_back (mod);
|
||||
else
|
||||
throw std::string ("The name '") + mod + "' is not a valid modifier";
|
||||
}
|
||||
else
|
||||
throw std::string ("Missing . or : after modifier");
|
||||
}
|
||||
|
@ -212,7 +217,10 @@ std::string Att::composeF4 () const
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Att::addMod (const std::string& mod)
|
||||
{
|
||||
mMods.push_back (mod);
|
||||
if (validMod (mod))
|
||||
mMods.push_back (mod);
|
||||
else
|
||||
throw std::string ("The name '") + mod + "' is not a valid modifier";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -140,11 +140,6 @@ int main (int argc, char** argv)
|
|||
try {a6.addMod ("endswith");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::addMod (endswith)");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
good = true;
|
||||
try {a6.addMod ("fartwizzle");} catch (...) {good = false;}
|
||||
t.notok (good, "Att::addMod (fartwizzle)");
|
||||
|
@ -152,8 +147,8 @@ int main (int argc, char** argv)
|
|||
// Att::mods
|
||||
std::vector <std::string> mods;
|
||||
a6.mods (mods);
|
||||
t.is (mods.size (), (size_t)1, "Att::mods () size == 1");
|
||||
t.is (mods[0], "is", "Att::mods [0] == 'is'");
|
||||
t.is (mods.size (), (size_t)18, "Att::mods () size == 18");
|
||||
t.is (mods[0], "is", "Att::mods [0] == 'is'");
|
||||
|
||||
// Att::parse
|
||||
Nibbler n ("");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue