Skip to content

Commit

Permalink
Fix tests on 1.0 and 1.5.
Browse files Browse the repository at this point in the history
Fixes #34.
  • Loading branch information
maleadt committed Jan 21, 2020
1 parent 135a469 commit 3784ac2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/CoverageTools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ module CoverageTools

# also check for line markers
if excluded || occursin("COV_EXCL_LINE", line)
@debug "removing line $l: $line"
coverage[l] = nothing
end
end
Expand Down
23 changes: 19 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ end
run(`$(Base.julia_cmd()) --startup-file=no --code-coverage=user -e $cmdstr`)
r = process_file(srcname, datadir)

target = CoverageTools.CovCount[nothing, 2, nothing, 0, nothing, 0, nothing, nothing, nothing, nothing, 0, nothing, nothing, nothing, nothing, nothing, 0, nothing, nothing, 0, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing]
target = if VERSION >= v"1.5.0-DEV.42"
CoverageTools.CovCount[nothing, 1, nothing, 0, nothing, 0, nothing, nothing, nothing, nothing, 0, nothing, nothing, nothing, nothing, nothing, 0, nothing, nothing, 0, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing]
else
CoverageTools.CovCount[nothing, 2, nothing, 0, nothing, 0, nothing, nothing, nothing, nothing, 0, nothing, nothing, nothing, nothing, nothing, 0, nothing, nothing, 0, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing]
end
target_disabled = map(x -> (x !== nothing && x > 0) ? x : nothing, target)
@test r.coverage == target

Expand Down Expand Up @@ -161,9 +165,20 @@ end
r = withenv("DISABLE_AMEND_COVERAGE_FROM_SRC" => "yes") do
process_file(srcname, "test")
end
@test r.coverage == [nothing, 2, 1, 1, nothing, 1, nothing, 1, nothing, nothing]
amend_coverage_from_src!(r.coverage, r.filename)
@test r.coverage == [nothing, 2, nothing, 1, nothing, nothing, nothing, 1, nothing, nothing]
# FIXME: coverage information for this function is useless with Julia 1.0
if VERSION >= v"1.1"
@test r.coverage == if VERSION >= v"1.5.0-DEV.42"
[nothing, 1, 1, 1, nothing, 1, nothing, 1, nothing]
else
[nothing, 2, 1, 1, nothing, 1, nothing, 1, nothing, nothing]
end
amend_coverage_from_src!(r.coverage, r.filename)
@test r.coverage == if VERSION >= v"1.5.0-DEV.42"
[nothing, 1, nothing, 1, nothing, nothing, nothing, 1, nothing]
else
[nothing, 2, nothing, 1, nothing, nothing, nothing, 1, nothing, nothing]
end
end
end
end

Expand Down

0 comments on commit 3784ac2

Please sign in to comment.