Add unit tests for endpoint errors#51
Conversation
|
Thanks for PR! You're right, some branches can't be covered without mocks, but apparently these branches are just impossible. For instance, if roc_endpoint_set_uri did not return error, then fromC will never fail. I think it's OK to keep these impossible cases uncovered, and avoid usage of mocks at all. In these tests, it's much more interesting to cover combination of go bindings + C lib, not just bindings alone, because most bugs will happen when they start working together. We can still cover a few possible cases without need for mocks:
Here is a part from URI ragel grammar (endpoint_uri_parse.rl from roc-toolkit): Here, |
a2e1fec to
37c507b
Compare
|
thanks for your help!
|
|
Great, thanks for your analysis. Could you also add a few more cases please?
Probably these cases won't increase reported coverage, but they're still important.
All cases in TestEndpoint use RTSP, which supports default port and resource part. Let's add two cases which try to use RTP (not RTSP) with:
|
|
I just got a thought, it would be also nice to add one successful case per each protocol (see here) to be sure that all constants in bindings are correctly mapped to corresponding C values. (Currently we cover only RTSP). |
|
Thank you! I also tried to add this test:
And realized that there is a bug, created an issue: roc-streaming/roc-toolkit#519 Here is a small follow-up PR: #56 |
close #42
it's not easy to set arguments where the test failed in the not covered errors
so use mock func instead
any guidance welcome 🙏