Commit 42f4cd7c authored by Dave Watson's avatar Dave Watson Committed by Alecs King

some moar unittests

Summary: from discussion

Test Plan: unit tests

Reviewed By: hans@fb.com

Subscribers: doug, folly-diffs@, jsedgwick, yfeldblum

FB internal diff: D1829282

Signature: t1:1829282:1423180907:3630dac1378750b05f316c672fbbd71138d2bc0a
parent 8f54229a
......@@ -160,3 +160,32 @@ TEST(Executor, RunnablePtr) {
x.addPtr(fnp);
EXPECT_EQ(counter, 1);
}
TEST(Executor, ThrowableThen) {
InlineExecutor x;
auto f = Future<void>().via(&x).then([](){
throw std::runtime_error("Faildog");
});
EXPECT_THROW(f.value(), std::exception);
}
class CrappyExecutor : public Executor {
public:
void add(Func f) override {
throw std::runtime_error("bad");
}
};
TEST(Executor, CrappyExecutor) {
CrappyExecutor x;
try {
auto f = Future<void>().via(&x).activate().then([](){
return;
});
f.value();
EXPECT_TRUE(false);
} catch(...) {
// via() should throw
return;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment