You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Jiri Daněk (Jira)" <ji...@apache.org> on 2020/09/24 20:22:00 UTC

[jira] [Updated] (DISPATCH-1783) Add ability to use test doubles (mocks, fakes, ...) in C tests

     [ https://issues.apache.org/jira/browse/DISPATCH-1783?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jiri Daněk updated DISPATCH-1783:
---------------------------------
    Description: 
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]

  was:
During the work on https://github.com/apache/qpid-dispatch/pull/684, there was at one point a version which allowed to what happens if a {{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]


> 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
>            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.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org