aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/libutil/closure.cc35
1 files changed, 4 insertions, 31 deletions
diff --git a/tests/unit/libutil/closure.cc b/tests/unit/libutil/closure.cc
index 7597e7807..b4eaad6f9 100644
--- a/tests/unit/libutil/closure.cc
+++ b/tests/unit/libutil/closure.cc
@@ -16,15 +16,11 @@ map<string, set<string>> testGraph = {
};
TEST(closure, correctClosure) {
- set<string> aClosure;
set<string> expectedClosure = {"A", "B", "C", "F", "G"};
- computeClosure<string>(
+ set<string> aClosure = computeClosure<string>(
{"A"},
- aClosure,
- [&](const string currentNode, function<void(promise<set<string>> &)> processEdges) {
- promise<set<string>> promisedNodes;
- promisedNodes.set_value(testGraph[currentNode]);
- processEdges(promisedNodes);
+ [&](const string currentNode) {
+ return testGraph[currentNode];
}
);
@@ -33,12 +29,10 @@ TEST(closure, correctClosure) {
TEST(closure, properlyHandlesDirectExceptions) {
struct TestExn {};
- set<string> aClosure;
EXPECT_THROW(
computeClosure<string>(
{"A"},
- aClosure,
- [&](const string currentNode, function<void(promise<set<string>> &)> processEdges) {
+ [&](const string currentNode) -> set<string> {
throw TestExn();
}
),
@@ -46,25 +40,4 @@ TEST(closure, properlyHandlesDirectExceptions) {
);
}
-TEST(closure, properlyHandlesExceptionsInPromise) {
- struct TestExn {};
- set<string> aClosure;
- EXPECT_THROW(
- computeClosure<string>(
- {"A"},
- aClosure,
- [&](const string currentNode, function<void(promise<set<string>> &)> processEdges) {
- promise<set<string>> promise;
- try {
- throw TestExn();
- } catch (...) {
- promise.set_exception(std::current_exception());
- }
- processEdges(promise);
- }
- ),
- TestExn
- );
-}
-
}