Commit d389009f authored by Lee Howes's avatar Lee Howes Committed by Facebook Github Bot

Make TimekeeperTest use thenError

Summary: Update to use thenError rather than onError.

Reviewed By: yfeldblum

Differential Revision: D14209634

fbshipit-source-id: 5cbb66146b148654641a7a0a58717a31608a4ac7
parent c17964fd
...@@ -195,30 +195,30 @@ TEST(Timekeeper, futureDelayedStickyExecutor) { ...@@ -195,30 +195,30 @@ TEST(Timekeeper, futureDelayedStickyExecutor) {
TEST(Timekeeper, futureWithinThrows) { TEST(Timekeeper, futureWithinThrows) {
Promise<int> p; Promise<int> p;
auto f = auto f = p.getFuture().within(one_ms).thenError(
p.getFuture().within(one_ms).onError([](FutureTimeout&) { return -1; }); tag_t<FutureTimeout>{}, [](auto&&) { return -1; });
EXPECT_EQ(-1, std::move(f).get()); EXPECT_EQ(-1, std::move(f).get());
} }
TEST(Timekeeper, semiFutureWithinThrows) { TEST(Timekeeper, semiFutureWithinThrows) {
Promise<int> p; Promise<int> p;
auto f = p.getSemiFuture().within(one_ms).toUnsafeFuture().onError( auto f = p.getSemiFuture().within(one_ms).toUnsafeFuture().thenError(
[](FutureTimeout&) { return -1; }); tag_t<FutureTimeout>{}, [](auto&&) { return -1; });
EXPECT_EQ(-1, std::move(f).get()); EXPECT_EQ(-1, std::move(f).get());
} }
TEST(Timekeeper, futureWithinAlreadyComplete) { TEST(Timekeeper, futureWithinAlreadyComplete) {
auto f = auto f = makeFuture(42).within(one_ms).thenError(
makeFuture(42).within(one_ms).onError([&](FutureTimeout&) { return -1; }); tag_t<FutureTimeout>{}, [&](auto&&) { return -1; });
EXPECT_EQ(42, std::move(f).get()); EXPECT_EQ(42, std::move(f).get());
} }
TEST(Timekeeper, semiFutureWithinAlreadyComplete) { TEST(Timekeeper, semiFutureWithinAlreadyComplete) {
auto f = makeSemiFuture(42).within(one_ms).toUnsafeFuture().onError( auto f = makeSemiFuture(42).within(one_ms).toUnsafeFuture().thenError(
[&](FutureTimeout&) { return -1; }); tag_t<FutureTimeout>{}, [&](auto&&) { return -1; });
EXPECT_EQ(42, std::move(f).get()); EXPECT_EQ(42, std::move(f).get());
} }
...@@ -227,7 +227,7 @@ TEST(Timekeeper, futureWithinFinishesInTime) { ...@@ -227,7 +227,7 @@ TEST(Timekeeper, futureWithinFinishesInTime) {
Promise<int> p; Promise<int> p;
auto f = p.getFuture() auto f = p.getFuture()
.within(std::chrono::minutes(1)) .within(std::chrono::minutes(1))
.onError([&](FutureTimeout&) { return -1; }); .thenError(tag_t<FutureTimeout>{}, [&](auto&&) { return -1; });
p.setValue(42); p.setValue(42);
EXPECT_EQ(42, std::move(f).get()); EXPECT_EQ(42, std::move(f).get());
...@@ -238,7 +238,7 @@ TEST(Timekeeper, semiFutureWithinFinishesInTime) { ...@@ -238,7 +238,7 @@ TEST(Timekeeper, semiFutureWithinFinishesInTime) {
auto f = p.getSemiFuture() auto f = p.getSemiFuture()
.within(std::chrono::minutes(1)) .within(std::chrono::minutes(1))
.toUnsafeFuture() .toUnsafeFuture()
.onError([&](FutureTimeout&) { return -1; }); .thenError(tag_t<FutureTimeout>{}, [&](auto&&) { return -1; });
p.setValue(42); p.setValue(42);
EXPECT_EQ(42, std::move(f).get()); EXPECT_EQ(42, std::move(f).get());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment