eranpeer / FakeIt

C++ mocking made easy. A simple yet very expressive, headers only library for c++ mocking.
MIT License
1.22k stars 170 forks source link

Allow mocks to be moved. #334

Closed FranckRJ closed 1 month ago

FranckRJ commented 1 month ago

Make mocks move-constructible, so they can be constructed from external functions. They could technically be move-assignable as well but I don't think it would be useful so I haven't done it.

They cannot be copy-constructible because the mocks can contain move-only objects (if a function returning a move-only object is mocked with Return(MoveOnly{}) then the mock will contain the move-only object that should be returned when that function is called), making them move-only as well.

This should fix #283 and #97.

coveralls commented 1 month ago

Coverage Status

coverage: 99.926%. remained the same when pulling 9428cd7c82cebe8c34d391b42015800c33d49dc0 on allow-moves-on-mocks into 52f86a896782aa24cfe36c9fd2bdd1a49d9f9990 on dev.