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

Over-reporting of coverage #11

Closed
timholy opened this issue Jul 2, 2014 · 3 comments
Closed

Over-reporting of coverage #11

timholy opened this issue Jul 2, 2014 · 3 comments

Comments

@timholy
Copy link
Member

timholy commented Jul 2, 2014

In working on JuliaLang/julia#7464, I've taken a closer look at how this package scores coverage. I think there's a problem of over-reporting.

Suppose we create the following file:

module Functions

export f1, f2

function f1(a, b)
    println(a, " ", b)
end

function f2(a, b)
    println(a, " ", a + b)
end

end

Now we run the following test script:

using Functions

f1(3,7)

as julia --code-coverage test.jl. We get the following coverage file:

        - module Functions
        - 
        - export f1, f2
        - 
        - function f1(a, b)
        1     println(a, " ", b)
        - end
        - 
        - function f2(a, b)
        -     println(a, " ", a + b)
        - end
        - 
        - end
        - 

As expected, f1 is marked as having run, but f2 is not. IIUC, this package will mark all lines that have a - in front of them with (javascript) null, and that is interpreted as not being relevant for coverage. So this "package" would be listed as having 100% coverage, despite the fact that half of the functions aren't tested.

To me it seems that the problem is (unfortunately) much harder, in that you have to parse the difference between lines like end that definitely shouldn't count against your coverage total vs. genuine lines of code that should have coverage but don't.

@IainNZ
Copy link
Contributor

IainNZ commented Jul 2, 2014

This is a dupe of #4, I'm not sure what I can do about it without using JuliaParser.jl which seems intimidating. I feel like it should probably be fixed in Julia.

@timholy timholy closed this as completed Jul 2, 2014
@IainNZ
Copy link
Contributor

IainNZ commented Jul 2, 2014

If you figure how to fix this in Julia you'll be my hero :D

@timholy
Copy link
Member Author

timholy commented Jul 2, 2014

I'll look into it. Won't be for a couple of days at least. And it's not obvious that this is easy to fix there, either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants