Add a full drain for folly's ManualExecutor.
[folly.git] / folly / executors / test / ExecutorTest.cpp
index 1755a2fc9e210fdcb37a50291b33de6b83c6c38a..2bbc56a1fa270081492f2efa545b7b75ba3959c2 100644 (file)
@@ -33,6 +33,20 @@ TEST(ManualExecutor, runIsStable) {
   auto f2 = [&]() { x.add(f1); x.add(f1); };
   x.add(f2);
   x.run();
+  EXPECT_EQ(count, 0);
+}
+
+TEST(ManualExecutor, drainIsNotStable) {
+  ManualExecutor x;
+  size_t count = 0;
+  auto f1 = [&]() { count++; };
+  auto f2 = [&]() {
+    x.add(f1);
+    x.add(f1);
+  };
+  x.add(f2);
+  x.drain();
+  EXPECT_EQ(count, 2);
 }
 
 TEST(ManualExecutor, scheduleDur) {