diff options
author | Copybara-Service <copybara-worker@google.com> | 2023-04-25 08:21:31 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-04-25 08:21:31 -0700 |
commit | ccdeec888ebb740a7ea4e07d3e84a1b7ee32b315 (patch) | |
tree | 46e8ab35bbc7c98039a1ede9d5328b3addd4be31 | |
parent | 783d00fd19865fcbc3065e3fb3e17144761fcf5a (diff) | |
parent | 51eeae5a5520166a385ce457b410d6309ac20968 (diff) | |
download | googletest-git-ccdeec888ebb740a7ea4e07d3e84a1b7ee32b315.tar.gz |
Merge pull request #4225 from TurboGawron:non_moveable_struct_fix
PiperOrigin-RevId: 526972449
Change-Id: I77d8bd37807f6c6ab5256f1e6c4abc64cceee740
-rw-r--r-- | googlemock/test/gmock-spec-builders_test.cc | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/googlemock/test/gmock-spec-builders_test.cc b/googlemock/test/gmock-spec-builders_test.cc index 7ba591a1..d07cb5cb 100644 --- a/googlemock/test/gmock-spec-builders_test.cc +++ b/googlemock/test/gmock-spec-builders_test.cc @@ -811,32 +811,32 @@ TEST(ExpectCallTest, InfersCardinality1WhenThereIsWillRepeatedly) { // from a prvalue returned from a function. TEST(ExpectCallTest, NonMoveableType) { // Define a non-moveable result type. - struct Result { - explicit Result(int x_in) : x(x_in) {} - Result(Result&&) = delete; + struct NonMoveableStruct { + explicit NonMoveableStruct(int x_in) : x(x_in) {} + NonMoveableStruct(NonMoveableStruct&&) = delete; int x; }; - static_assert(!std::is_move_constructible_v<Result>); - static_assert(!std::is_copy_constructible_v<Result>); + static_assert(!std::is_move_constructible_v<NonMoveableStruct>); + static_assert(!std::is_copy_constructible_v<NonMoveableStruct>); - static_assert(!std::is_move_assignable_v<Result>); - static_assert(!std::is_copy_assignable_v<Result>); + static_assert(!std::is_move_assignable_v<NonMoveableStruct>); + static_assert(!std::is_copy_assignable_v<NonMoveableStruct>); // We should be able to use a callable that returns that result as both a // OnceAction and an Action, whether the callable ignores arguments or not. - const auto return_17 = [] { return Result(17); }; + const auto return_17 = [] { return NonMoveableStruct(17); }; - static_cast<void>(OnceAction<Result()>{return_17}); - static_cast<void>(Action<Result()>{return_17}); + static_cast<void>(OnceAction<NonMoveableStruct()>{return_17}); + static_cast<void>(Action<NonMoveableStruct()>{return_17}); - static_cast<void>(OnceAction<Result(int)>{return_17}); - static_cast<void>(Action<Result(int)>{return_17}); + static_cast<void>(OnceAction<NonMoveableStruct(int)>{return_17}); + static_cast<void>(Action<NonMoveableStruct(int)>{return_17}); // It should be possible to return the result end to end through an // EXPECT_CALL statement, with both WillOnce and WillRepeatedly. - MockFunction<Result()> mock; + MockFunction<NonMoveableStruct()> mock; EXPECT_CALL(mock, Call) // .WillOnce(return_17) // .WillRepeatedly(return_17); |