Commit 2e521043 authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot 4

Fix the base gen test with GTest 1.7

Summary: Becuase it has bugs that cause the compiler to error :(

Reviewed By: ericniebler

Differential Revision: D3571263

fbshipit-source-id: 9a17fc2c3c7344c3532df33cd4b84517c97d8efc
parent ebcf92c2
...@@ -1231,17 +1231,17 @@ TEST(Gen, Unwrap) { ...@@ -1231,17 +1231,17 @@ TEST(Gen, Unwrap) {
auto oup = folly::make_optional(folly::make_unique<int>(5)); auto oup = folly::make_optional(folly::make_unique<int>(5));
// optional has a value, and that value is non-null // optional has a value, and that value is non-null
EXPECT_TRUE(oup | unwrap); EXPECT_TRUE(bool(oup | unwrap));
EXPECT_EQ(5, *(oup | unwrap)); EXPECT_EQ(5, *(oup | unwrap));
EXPECT_TRUE(oup.hasValue()); // still has a pointer (null or not) EXPECT_TRUE(oup.hasValue()); // still has a pointer (null or not)
EXPECT_TRUE(oup.value()); // that value isn't null EXPECT_TRUE(bool(oup.value())); // that value isn't null
auto moved1 = std::move(oup) | unwrapOr(folly::make_unique<int>(6)); auto moved1 = std::move(oup) | unwrapOr(folly::make_unique<int>(6));
// oup still has a value, but now it's now nullptr since the pointer was moved // oup still has a value, but now it's now nullptr since the pointer was moved
// into moved1 // into moved1
EXPECT_TRUE(oup.hasValue()); EXPECT_TRUE(oup.hasValue());
EXPECT_FALSE(oup.value()); EXPECT_FALSE(oup.value());
EXPECT_TRUE(moved1); EXPECT_TRUE(bool(moved1));
EXPECT_EQ(5, *moved1); EXPECT_EQ(5, *moved1);
auto moved2 = std::move(oup) | unwrapOr(folly::make_unique<int>(7)); auto moved2 = std::move(oup) | unwrapOr(folly::make_unique<int>(7));
...@@ -1251,7 +1251,7 @@ TEST(Gen, Unwrap) { ...@@ -1251,7 +1251,7 @@ TEST(Gen, Unwrap) {
oup.clear(); oup.clear();
auto moved3 = std::move(oup) | unwrapOr(folly::make_unique<int>(8)); auto moved3 = std::move(oup) | unwrapOr(folly::make_unique<int>(8));
// oup is empty now, so the unwrapOr comes into play. // oup is empty now, so the unwrapOr comes into play.
EXPECT_TRUE(moved3); EXPECT_TRUE(bool(moved3));
EXPECT_EQ(8, *moved3); EXPECT_EQ(8, *moved3);
{ {
...@@ -1290,14 +1290,14 @@ TEST(Gen, Unwrap) { ...@@ -1290,14 +1290,14 @@ TEST(Gen, Unwrap) {
auto fallback = unwrapOr(folly::make_unique<int>(9)); auto fallback = unwrapOr(folly::make_unique<int>(9));
// fallback must be std::move'd to be used // fallback must be std::move'd to be used
EXPECT_EQ(8, *(opt | std::move(fallback))); EXPECT_EQ(8, *(opt | std::move(fallback)));
EXPECT_TRUE(opt.value()); // shared_ptr copied out, not moved EXPECT_TRUE(bool(opt.value())); // shared_ptr copied out, not moved
EXPECT_TRUE(opt); // value still present EXPECT_TRUE(bool(opt)); // value still present
EXPECT_TRUE(fallback.value()); // fallback value not needed EXPECT_TRUE(bool(fallback.value())); // fallback value not needed
EXPECT_EQ(8, *(std::move(opt) | std::move(fallback))); EXPECT_EQ(8, *(std::move(opt) | std::move(fallback)));
EXPECT_FALSE(opt.value()); // shared_ptr moved out EXPECT_FALSE(opt.value()); // shared_ptr moved out
EXPECT_TRUE(opt); // gutted value still present EXPECT_TRUE(bool(opt)); // gutted value still present
EXPECT_TRUE(fallback.value()); // fallback value not needed EXPECT_TRUE(bool(fallback.value())); // fallback value not needed
opt.clear(); opt.clear();
......
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