Get rid of try/catch in messageAvailable, which is now noexcept
[folly.git] / folly / io / async / test / EventBaseTest.cpp
index 01157f916da0f6a0a2b79a6ff70ebedd7bfe9ef9..ae455c7eb613ecb63a506a4dfbe5b049131a3c01 100644 (file)
@@ -1351,6 +1351,21 @@ TEST(EventBaseTest, RunInLoopStopLoop) {
   ASSERT_LE(c1.getCount(), 11);
 }
 
+TEST(EventBaseTest, messageAvailableException) {
+  auto deadManWalking = [] {
+    EventBase eventBase;
+    std::thread t([&] {
+      // Call this from another thread to force use of NotificationQueue in
+      // runInEventBaseThread
+      eventBase.runInEventBaseThread(
+          []() { throw std::runtime_error("boom"); });
+    });
+    t.join();
+    eventBase.loopForever();
+  };
+  EXPECT_DEATH(deadManWalking(), ".*");
+}
+
 TEST(EventBaseTest, TryRunningAfterTerminate) {
   EventBase eventBase;
   CountedLoopCallback c1(&eventBase, 1,