MicroCoverage.jl is a code coverage tool for Julia, implemented in pure Julia.
julia> using Pkg; Pkg.add("MicroCoverage")Step 1: Create a file named foo.jl with the following contents:
function foo(x)
    if x == 1 || x == 100
        return "hello"
    else
        return "goodbye"
    end
endStep 2: Create a file named test_foo.jl with the following contents:
using Test
@test foo(1) == "hello"Step 3: Open julia and run the following commands:
julia> using MicroCoverage
julia> MicroCoverage.start("foo.jl")
julia> include("foo.jl")
julia> include("test_foo.jl")
julia> MicroCoverage.stop()When you run MicroCoverage.stop(), MicroCoverage will create
a file named foo.jl.microcov with the following contents:
[1,1,1]                 function foo(x)
[1,0,1,0,1]                 if x == 1 || x == 100
[1]                             return "hello"
-                           else
[0]                             return "goodbye"
-                           end
-                       end
-- This work was supported in part by National Institutes of Health grants U54GM115677, R01LM011963, and R25MH116440. The content is solely the responsibility of the authors and does not necessarily represent the official views of the National Institutes of Health.