Fix copyright lines
[folly.git] / folly / test / ExpectedTest.cpp
index da2ede70ccc73cbbcde583aa35ab9c0313a5b39b..1431d1809e6be9c784f1eec4ad384ad54af33b24 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017 Facebook, Inc.
+ * Copyright 2016-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.
@@ -15,6 +15,7 @@
  */
 
 #include <folly/Expected.h>
+#include <folly/Portability.h>
 #include <folly/portability/GTest.h>
 
 #include <algorithm>
@@ -229,10 +230,10 @@ TEST(Expected, Unique) {
 
   ex = makeUnexpected(-1);
   // empty->moved
-  ex = unique_ptr<int>(new int(6));
+  ex = std::make_unique<int>(6);
   EXPECT_EQ(6, **ex);
   // full->moved
-  ex = unique_ptr<int>(new int(7));
+  ex = std::make_unique<int>(7);
   EXPECT_EQ(7, **ex);
 
   // move it out by move construct
@@ -452,7 +453,7 @@ TEST(Expected, MakeOptional) {
   EXPECT_EQ(**exIntPtr, 3);
 }
 
-#if __clang__
+#if __CLANG_PREREQ(3, 6)
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wself-move"
 #endif
@@ -467,7 +468,7 @@ TEST(Expected, SelfAssignment) {
   ASSERT_TRUE(b.hasValue() && b.value() == "23333333");
 }
 
-#if __clang__
+#if __CLANG_PREREQ(3, 6)
 #pragma clang diagnostic pop
 #endif
 
@@ -675,7 +676,7 @@ TEST(Expected, Then) {
     // Error case:
     Expected<int, E> ex = Expected<std::unique_ptr<int>, E>{
         unexpected, E::E1}.then([](std::unique_ptr<int> p) -> int {
-      EXPECT_TRUE(false);
+      ADD_FAILURE();
       return *p;
     });
     EXPECT_FALSE(bool(ex));
@@ -743,4 +744,4 @@ TEST(Expected, ThenOrThrow) {
         Unexpected<E>::BadExpectedAccess);
   }
 }
-}
+} // namespace folly