1 parent
f0825fbd1a
commit
42268c6c35
45 files changed
+2732
-262
No files matched your search
@@ -0,0 +1,24 @@
|
||||
#include <Void/Testing/Assert.hpp>
|
||||
#include <Void/Testing/Test.hpp>
|
||||
#include <Void/TestingMock/MockFunction.hpp>
|
||||
|
||||
#include <memory>
|
||||
|
||||
// std::move_only_function support: a unique_ptr-capturing lambda used to
|
||||
// fail to compile against std::function. With Phase 2.3.4 the action
|
||||
// holder is std::move_only_function, so this works.
|
||||
Void::Testing::Test invokes_accepts_unique_ptr_capturing_lambda()
|
||||
{
|
||||
using namespace Void::TestingMock;
|
||||
MockFunction<int(int)> fn{"counter"};
|
||||
|
||||
auto state = std::make_unique<int>(10);
|
||||
|
||||
fn.expect(_<int>())
|
||||
.invokes(
|
||||
[s = std::move(state)](int delta) -> int { return *s + delta; })
|
||||
.times(2);
|
||||
|
||||
Void::Testing::expect_eq(fn(1), 11);
|
||||
Void::Testing::expect_eq(fn(5), 15);
|
||||
}
|
||||
Reference in new issue
Block a user