Fix copyright lines
[folly.git] / folly / experimental / hazptr / test / HazptrTest.cpp
index 9d71cda38b4d20581f959aa9db0aba9ad8c346e9..44128e81395959f8f5ec8e042cee86df3a606405 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.
@@ -380,6 +380,7 @@ TEST_F(HazptrTest, Array) {
   {
     // Abnormal case
     hazptr_array<HAZPTR_TC_SIZE + 1> h;
+    hazptr_array<HAZPTR_TC_SIZE + 1> h2(std::move(h));
   }
 }
 
@@ -551,3 +552,25 @@ TEST_F(HazptrTest, mt_refcount) {
   CHECK_EQ(constructed.load(), num);
   CHECK_EQ(destroyed.load(), num);
 }
+
+TEST_F(HazptrTest, FreeFunctionRetire) {
+  auto foo = new int;
+  hazptr_retire(foo);
+  auto foo2 = new int;
+  hazptr_retire(foo2, [](int* obj) { delete obj; });
+
+  bool retired = false;
+  {
+    hazptr_domain myDomain0;
+    struct delret {
+      bool* retired_;
+      delret(bool* retire) : retired_(retire) {}
+      ~delret() {
+        *retired_ = true;
+      }
+    };
+    auto foo3 = new delret(&retired);
+    myDomain0.retire(foo3);
+  }
+  EXPECT_TRUE(retired);
+}