Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lines wrongly reported as uncovered #8867

Open
albertored opened this issue Sep 27, 2024 · 0 comments
Open

Lines wrongly reported as uncovered #8867

albertored opened this issue Sep 27, 2024 · 0 comments
Assignees
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM

Comments

@albertored
Copy link
Contributor

albertored commented Sep 27, 2024

This is a follow up of elixir-lang/elixir#13863.

I had a problem on elixir where some lines of my code was reported as uncovered also if tests correctly cover them. I was able to reproduce the problem also with plain Erlang code so I'm opening the bug here.

This the module under test

-module(cover_bug).

-export([myfun/2]).

myfun(Arg1, <<"bar", _>>) when Arg1 == arg1 orelse Arg1 == arg2 ->
    nil;
myfun(arg3, Arg2) ->
    case lists:sum([10, 2]) of
        12 ->
            Res = Arg2,
            Res
    end.

and this is the test

?assertEqual(cover_bug:myfun(arg3, <<"foo">>), <<"foo">>)

After running that test the second clause of the function is wrongly reported as uncovered. As better explained in the linked Elixir issue almost every change to the code makes the cover report correct again.

Affected versions
This happens with OTP 27.1, I've tried also with OTP 26.2.5 and in that case the behaviour is correct.

@albertored albertored added the bug Issue is reported as a bug label Sep 27, 2024
@IngelaAndin IngelaAndin added the team:VM Assigned to OTP team VM label Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM
Projects
None yet
Development

No branches or pull requests

3 participants