[
https://issues.apache.org/jira/browse/DISPATCH-1783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17465210#comment-17465210
]
ASF GitHub Bot commented on DISPATCH-1783:
------------------------------------------
jiridanek commented on a change in pull request #1469:
URL: https://github.com/apache/qpid-dispatch/pull/1469#discussion_r775140536
##########
File path: tests/c_unittests/test_terminus.cpp
##########
@@ -73,6 +83,16 @@ TEST_CASE("test_safe_snprintf") {
CHECK(0 == len);
}
}
+ SUBCASE("vsnprintf failure") {
+ Stub stub;
+ stub.set(vsnprintf, vsnprintf_stub::stub);
Review comment:
lambda does not work here
```
/home/jdanek/repos/qpid/qpid-dispatch/tests/c_unittests/test_terminus.cpp:89:92:
sorry, unimplemented: converting lambda that uses ‘...’ to function pointer
89 | stub.set(vsnprintf, +[](char *str, size_t size, const char
*format, ...){return -1;});
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
> Add ability to use test doubles (mocks, fakes, ...) in C tests
> --------------------------------------------------------------
>
> Key: DISPATCH-1783
> URL: https://issues.apache.org/jira/browse/DISPATCH-1783
> Project: Qpid Dispatch
> Issue Type: Improvement
> Components: Tests
> Affects Versions: 1.14.0
> Reporter: Jiri Daněk
> Priority: Major
>
> During the work on https://github.com/apache/qpid-dispatch/pull/684, there
> was at one point a version of the PR, which tested what happens if
> {{vsnprintf}} called from {{safe_snprinf}} returns {{-1}}.
> This was done by replacing the {{vsnprintf}} with a mock (technically it's
> probably a stub, or maybe fake, but let's ignore the proper terminology).
> There are various possibilities how to approach mocking in C. They are less
> nice than in more dynamic languages such as Java, or even C++ (where it's
> possible to subclass things). Nevertheless, it can be useful technique, and
> it should be explored.
> CC [~cans]
--
This message was sent by Atlassian Jira
(v8.20.1#820001)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]