mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Add some more cases for the serialization test of expectations
Make sure the various constraint names/values are kept (they are stored type-erased!)
This commit is contained in:
parent
e2687dea1a
commit
23ac665c22
1 changed files with 11 additions and 4 deletions
|
|
@ -751,11 +751,18 @@ BOOST_FIXTURE_TEST_CASE(expectation_can_be_serialized_to_be_human_readable, mock
|
|||
{
|
||||
mock::detail::function<void(int)> f;
|
||||
f.expect().once().with(1);
|
||||
f.expect().once().with(2);
|
||||
f.expect().once().with(mock::close(3, 1));
|
||||
int target = 0;
|
||||
f.expect().once().with(mock::retrieve(target));
|
||||
f.expect().once().with(mock::same(target));
|
||||
BOOST_CHECK_NO_THROW(f(2));
|
||||
const std::string expected = "?\n"
|
||||
". once().with( 1 )\n"
|
||||
"v once().with( 2 )";
|
||||
std::string expected = "?\n"; // Not in a current call context
|
||||
expected += ". once().with( 1 )\n"; // Unmet/Unverified expectation with value
|
||||
expected += "v once().with( close( 3, 1 ) )\n"; // Verified expectation with constraint
|
||||
target = 42;
|
||||
// (Unverified) expectation with retrieve/same constraint print current value
|
||||
expected += ". once().with( retrieve( 42 ) )\n";
|
||||
expected += ". once().with( same( 42 ) )";
|
||||
BOOST_CHECK_EQUAL(expected, to_string(f));
|
||||
CHECK_CALLS(1);
|
||||
f.reset();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue