Commit 235fb4c0 authored by Mirek Klimos's avatar Mirek Klimos Committed by Facebook Github Bot 3

Fix FiberManager.RequestContext unit test

Summary: with the added blocks, pointer to RequestContext needs to be captured by value, not reference

Differential Revision: D3499921

fbshipit-source-id: 76ff22869228fbdd7ef1651cd2814550f6abc301
parent f285646c
......@@ -1270,7 +1270,7 @@ TEST(FiberManager, RequestContext) {
{
folly::RequestContextScopeGuard rctx;
auto rcontext1 = folly::RequestContext::get();
fm.addTask([&]() {
fm.addTask([&, rcontext1]() {
EXPECT_EQ(rcontext1, folly::RequestContext::get());
baton1.wait(
[&]() { EXPECT_EQ(rcontext1, folly::RequestContext::get()); });
......@@ -1283,7 +1283,7 @@ TEST(FiberManager, RequestContext) {
{
folly::RequestContextScopeGuard rctx;
auto rcontext2 = folly::RequestContext::get();
fm.addTaskRemote([&]() {
fm.addTaskRemote([&, rcontext2]() {
EXPECT_EQ(rcontext2, folly::RequestContext::get());
baton2.wait();
EXPECT_EQ(rcontext2, folly::RequestContext::get());
......@@ -1294,14 +1294,14 @@ TEST(FiberManager, RequestContext) {
folly::RequestContextScopeGuard rctx;
auto rcontext3 = folly::RequestContext::get();
fm.addTaskFinally(
[&]() {
[&, rcontext3]() {
EXPECT_EQ(rcontext3, folly::RequestContext::get());
baton3.wait();
EXPECT_EQ(rcontext3, folly::RequestContext::get());
return folly::Unit();
},
[&](Try<folly::Unit>&& /* t */) {
[&, rcontext3](Try<folly::Unit>&& /* t */) {
EXPECT_EQ(rcontext3, folly::RequestContext::get());
checkRun3 = true;
});
......
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