File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -482,7 +482,7 @@ Sometimes it is useful to access the mocking framework from a .c file rather tha
482482#include "CppUTestExt/MockSupport_c.h"
483483
484484mock_c()->expectOneCall("foo")->withIntParameters("integer", 10)->andReturnDoubleValue(1.11);
485- mock_c()->actualCall("foo")->withIntParameters("integer", 10)->returnValue().value.doubleValue;
485+ return mock_c()->actualCall("foo")->withIntParameters("integer", 10)->returnValue().value.doubleValue;
486486
487487mock_c()->installComparator("type", equalMethod, toStringMethod);
488488mock_scope_c("scope")->expectOneCall("bar")->withParameterOfType("type", "name", object);
@@ -497,6 +497,20 @@ mock_c()->clear();
497497
498498The C interface uses a similar builder structure as the C++ interface. It is far less common in C, but it works the same.
499499
500+ It is now also possible to specify the actual return value in the same way as with C++ (3.8):
501+
502+ {% highlight c++ %}
503+ return mock_c()->actualCall("foo")->withIntParameters("integer", 10)->doubleReturnValue();
504+ return mock_c()->doubleReturnValue();
505+ {% endhighlight %}
506+
507+ and to specify a default return value, in case mocking is currently disabled when the actual call occurs (3.8):
508+
509+ {% highlight c++ %}
510+ return mock_c()->actualCall("foo")->withIntParameters("integer", 10)->returnDoubleValueOrDefault(2.25);
511+ return mock_c()->returnDoubleValueOrDefault(2.25);
512+ {% endhighlight %}
513+
500514<a id =" miscellaneous " ></a >
501515
502516### Miscellaneous
You can’t perform that action at this time.
0 commit comments