Re: PHP test coverage
| From: | Niels Dossche | Date: | Fri, 08 Dec 2023 16:08:52 +0000 |
| Subject: | Re: PHP test coverage | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-121964@lists.php.net to get a copy of this message | ||
Hi
On 08/12/2023 17:04, Vinicius Dias wrote:
>> The code coverage report can be found at
>> https://app.codecov.io/github/php/php-src
>
> Ah, perfect. Thank you for sharing. I will take a closer look after
> work, but something seems weird to me. Here[1] you see that
> ctype_alpha seems to be uncovered, but here[2] we can see that it's
> tested.
>
> [1]:
> https://app.codecov.io/github/php/php-src/blob/master/ext%2Fctype%2Fctype.c#L112
> [2]:
> https://github.com/php/php-src/blob/master/ext/ctype/tests/ctype_alpha_basic.phptµ$*{”‚W">Îþ
> ÐYö\
You'll see this kind of stuff with macros.
The coverage report shows "partially covered" code as uncovered due to a limitation.
In this particular example, the parameter parsing code failure isn't tested, so it marks the
whole macro as untested.
You'll see this many times in the PHP codebase.
Also for example for RETURN_THROWS: because that macro performs an assertion it's always in red
because the assertion isn't hit in our testing (and that's a good thing because if it were
hit then it means there's a bug).
Kind regards
Niels
>
>
>> I will have a look, the page overall looks like it could need some love ;-)
>> In the meantime if you are interested in writing tests, I once wrote a blog post about that
>> topic at
>> https://dev.to/realflowcontrol/growing-the-php-core-one-test-at-a-time-4g4k
> Ah, that's great. Thank you for that! :-D
>