| 11 | namespace leveldb { |
| 12 | |
| 13 | TEST(Status, MoveConstructor) { |
| 14 | { |
| 15 | Status ok = Status::OK(); |
| 16 | Status ok2 = std::move(ok); |
| 17 | |
| 18 | ASSERT_TRUE(ok2.ok()); |
| 19 | } |
| 20 | |
| 21 | { |
| 22 | Status status = Status::NotFound("custom NotFound status message"); |
| 23 | Status status2 = std::move(status); |
| 24 | |
| 25 | ASSERT_TRUE(status2.IsNotFound()); |
| 26 | ASSERT_EQ("NotFound: custom NotFound status message", status2.ToString()); |
| 27 | } |
| 28 | |
| 29 | { |
| 30 | Status self_moved = Status::IOError("custom IOError status message"); |
| 31 | |
| 32 | // Needed to bypass compiler warning about explicit move-assignment. |
| 33 | Status& self_moved_reference = self_moved; |
| 34 | self_moved_reference = std::move(self_moved); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | } // namespace leveldb |
| 39 | |