Enhancement

- More consistent test of when adding or deleting a dependency.
- Update one unit test.
This commit is contained in:
Louis-Claude Canon 2012-05-05 10:06:19 +02:00 committed by Paul Beckingham
parent 20ae5fed81
commit 5ffb65b5ac
2 changed files with 8 additions and 1 deletions

View file

@ -801,6 +801,11 @@ void Task::addDependency (const std::string& uuid)
if (uuid == get ("uuid"))
throw std::string (STRING_TASK_DEPEND_ITSELF);
// Check that uuid is resolvable.
int id = context.tdb2.pending.id (uuid);
if (id == 0)
throw format (STRING_TASK_DEPEND_MISS_CREA, id);
// Store the dependency.
std::string depends = get ("depends");
if (depends != "")
@ -837,6 +842,8 @@ void Task::removeDependency (const std::string& uuid)
set ("depends", combined);
recalc_urgency = true;
}
else
throw format (STRING_TASK_DEPEND_MISS_DEL, uuid);
}
////////////////////////////////////////////////////////////////////////////////