Skip to content

Lower coverage in Julia v1.11 #346

@schillic

Description

@schillic

In Julia v1.10.6, the code below gets 100% coverage. In Julia v1.11.1, foo is not marked as covered.

src/Example.jl:

module Example

export foo, bar

function foo(x) end       # covered in v1.10 but not covered in v1.11
function bar(x; o=1) end  # covered in both versions

end

test/runtests.jl:

using Example, Test

@test isnothing(foo(1))
@test isnothing(bar(1))

I understand that this package uses a workaround to mark lines as code that then may not be marked as covered. Indeed, with DISABLE_AMEND_COVERAGE_FROM_SRC=yes, I get full coverage in v1.11.

Based on that, I presume the explanation here is that the compiler optimizes foo out, while bar has a default parameter and somehow gets tracked anyway.

But I am surprised to see this change when switching between Julia versions. My questions are:

  • Is this intended behavior?
  • Is there a way to get full coverage back in v1.11 without setting the environment variable?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions