LevelDB project 1 10225501460 林子骥 10211900416 郭夏辉
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 line
991 B

1 月之前
  1. // Copyright (c) 2018 The LevelDB Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file. See the AUTHORS file for names of contributors.
  4. #include "leveldb/status.h"
  5. #include <utility>
  6. #include "gtest/gtest.h"
  7. #include "leveldb/slice.h"
  8. namespace leveldb {
  9. TEST(Status, MoveConstructor) {
  10. {
  11. Status ok = Status::OK();
  12. Status ok2 = std::move(ok);
  13. ASSERT_TRUE(ok2.ok());
  14. }
  15. {
  16. Status status = Status::NotFound("custom NotFound status message");
  17. Status status2 = std::move(status);
  18. ASSERT_TRUE(status2.IsNotFound());
  19. ASSERT_EQ("NotFound: custom NotFound status message", status2.ToString());
  20. }
  21. {
  22. Status self_moved = Status::IOError("custom IOError status message");
  23. // Needed to bypass compiler warning about explicit move-assignment.
  24. Status& self_moved_reference = self_moved;
  25. self_moved_reference = std::move(self_moved);
  26. }
  27. }
  28. } // namespace leveldb