mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-20 04:13:07 +02:00
Enhancement
- More consistent test of when adding or deleting a dependency. - Update one unit test.
This commit is contained in:
parent
20ae5fed81
commit
5ffb65b5ac
2 changed files with 8 additions and 1 deletions
|
@ -801,6 +801,11 @@ void Task::addDependency (const std::string& uuid)
|
||||||
if (uuid == get ("uuid"))
|
if (uuid == get ("uuid"))
|
||||||
throw std::string (STRING_TASK_DEPEND_ITSELF);
|
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.
|
// Store the dependency.
|
||||||
std::string depends = get ("depends");
|
std::string depends = get ("depends");
|
||||||
if (depends != "")
|
if (depends != "")
|
||||||
|
@ -837,6 +842,8 @@ void Task::removeDependency (const std::string& uuid)
|
||||||
set ("depends", combined);
|
set ("depends", combined);
|
||||||
recalc_urgency = true;
|
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]
|
# [2]
|
||||||
my $output = qx{../src/task rc:dep.rc 1 modify dep:-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]
|
# [3]
|
||||||
$output = qx{../src/task rc:dep.rc 1 modify dep:99};
|
$output = qx{../src/task rc:dep.rc 1 modify dep:99};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue