X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2Ffutures%2Ftest%2FTimekeeperTest.cpp;h=fdf17ed55d0a2523d2ff5cd030727084490d1535;hb=084ff8d9934675912ee1af8687611eb34a630579;hp=4567b93c3f1b70558e29d4e477f1af7e252634ec;hpb=c78133696b5e489fbe20d3ebea51e9c1bf08e2f0;p=folly.git diff --git a/folly/futures/test/TimekeeperTest.cpp b/folly/futures/test/TimekeeperTest.cpp index 4567b93c..fdf17ed5 100644 --- a/folly/futures/test/TimekeeperTest.cpp +++ b/folly/futures/test/TimekeeperTest.cpp @@ -88,6 +88,16 @@ TEST(Timekeeper, futureSleepHandlesNullTimekeeperSingleton) { EXPECT_THROW(futures::sleep(one_ms).get(), NoTimekeeper); } +TEST(Timekeeper, futureWithinHandlesNullTimekeeperSingleton) { + Singleton::make_mock([] { return nullptr; }); + SCOPE_EXIT { + Singleton::make_mock(); + }; + Promise p; + auto f = p.getFuture().within(one_ms); + EXPECT_THROW(f.get(), NoTimekeeper); +} + TEST(Timekeeper, futureDelayed) { auto t1 = now(); auto dur = makeFuture()