Enhancement
- More consistent test of when adding or deleting a dependency. - Update one unit test.
This commit is contained in:
committed by
Paul Beckingham
parent
20ae5fed81
commit
5ffb65b5ac
@@ -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);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -50,7 +50,7 @@ qx{../src/task rc:dep.rc add Two};
|
||||
|
||||
# [2]
|
||||
my $output = qx{../src/task rc:dep.rc 1 modify dep:-2};
|
||||
like ($output, qr/Modified 0 tasks\./, 'dependencies - remove nonexistent dependency');
|
||||
like ($output, qr/Could not delete a dependency on task 2 - not found\./, 'dependencies - remove nonexistent dependency');
|
||||
|
||||
# [3]
|
||||
$output = qx{../src/task rc:dep.rc 1 modify dep:99};
|
||||
|
||||
Reference in New Issue
Block a user