/*
- * 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.
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()