Fix copyright lines
[folly.git] / folly / futures / test / TimekeeperTest.cpp
index 4567b93c3f1b70558e29d4e477f1af7e252634ec..3c5464a4a22f6b5db50adb6a8bb4f963d9c4cffe 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 Facebook, Inc.
+ * Copyright 2014-present Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -88,6 +88,16 @@ TEST(Timekeeper, futureSleepHandlesNullTimekeeperSingleton) {
   EXPECT_THROW(futures::sleep(one_ms).get(), NoTimekeeper);
 }
 
+TEST(Timekeeper, futureWithinHandlesNullTimekeeperSingleton) {
+  Singleton<ThreadWheelTimekeeper>::make_mock([] { return nullptr; });
+  SCOPE_EXIT {
+    Singleton<ThreadWheelTimekeeper>::make_mock();
+  };
+  Promise<int> p;
+  auto f = p.getFuture().within(one_ms);
+  EXPECT_THROW(f.get(), NoTimekeeper);
+}
+
 TEST(Timekeeper, futureDelayed) {
   auto t1 = now();
   auto dur = makeFuture()