diff options
author | Abseil Team <absl-team@google.com> | 2018-04-25T17·38-0700 |
---|---|---|
committer | Derek Mauro <dmauro@google.com> | 2018-04-25T17·44-0400 |
commit | ea0e750e52ee223db34a242f9a7229ac04a0f473 (patch) | |
tree | 993e0c54fcab171bccc28bc5c646653f6e8c5638 /absl/utility/utility_test.cc | |
parent | 19b3c95727316cef3b0b40eaf37f6645a876f8d2 (diff) |
- 2f6a3c92ce0f64e0923ad326ec5d07eae03061fd Add C++14's std::exchange to absl/utility/utility.h. by Abseil Team <absl-team@google.com>
- 9f2c9adbf998dd9062c8cc3da1076bde87081d71 Fix comment typo. by Greg Falcon <gfalcon@google.com> GitOrigin-RevId: 2f6a3c92ce0f64e0923ad326ec5d07eae03061fd Change-Id: I7b9db94ad315092baefe56b02f250acadafbe312
Diffstat (limited to 'absl/utility/utility_test.cc')
-rw-r--r-- | absl/utility/utility_test.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/absl/utility/utility_test.cc b/absl/utility/utility_test.cc index 342165ed5240..3c447b20bb04 100644 --- a/absl/utility/utility_test.cc +++ b/absl/utility/utility_test.cc @@ -333,5 +333,13 @@ TEST(ApplyTest, FlipFlop) { EXPECT_EQ(42, absl::apply(&FlipFlop::member, std::make_tuple(obj))); } +TEST(ExchangeTest, MoveOnly) { + auto a = Factory(1); + EXPECT_EQ(1, *a); + auto b = absl::exchange(a, Factory(2)); + EXPECT_EQ(2, *a); + EXPECT_EQ(1, *b); +} + } // namespace |