Skip to content

Commit

Permalink
Add tests (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
DilumAluthge committed Jun 8, 2021
1 parent 769ea63 commit 682b616
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Project.toml
@@ -1,7 +1,7 @@
name = "CoverageTools"
uuid = "c36e975a-824b-4404-a568-ef97ca766997"
authors = ["Iain Dunning <iaindunning@gmail.com>"]
version = "1.2.3"
version = "1.2.4"

[compat]
julia = "0.7, 1"
Expand Down
4 changes: 1 addition & 3 deletions src/CoverageTools.jl
Expand Up @@ -195,9 +195,7 @@ module CoverageTools
if !isempty(flines)
flines .+= lineoffset
for l in flines
if l > length(coverage)
resize!(coverage, l)
end
(l > length(coverage)) && resize!(coverage, l)
if coverage[l] === nothing
coverage[l] = 0
end
Expand Down
33 changes: 15 additions & 18 deletions test/runtests.jl
@@ -1,17 +1,11 @@
#######################################################################
# CoverageTools.jl
# Take Julia test coverage results and bundle them up in JSONs
# https://github.com/JuliaCI/CoverageTools.jl
#######################################################################

using CoverageTools, Test
using CoverageTools
using Test

if VERSION < v"1.1-"
isnothing(x) = false
isnothing(x::Nothing) = true
isnothing(x) = false
isnothing(x::Nothing) = true
end

@testset "CoverageTools" begin
withenv("DISABLE_AMEND_COVERAGE_FROM_SRC" => nothing) do

@testset "iscovfile" begin
Expand All @@ -30,7 +24,7 @@ withenv("DISABLE_AMEND_COVERAGE_FROM_SRC" => nothing) do
@test CoverageTools.iscovfile("test.jl.8392.cov", "test.jl")
@test CoverageTools.iscovfile("/somedir/test.jl.8392.cov", "/somedir/test.jl")
@test !CoverageTools.iscovfile("/otherdir/test.jl.cov", "/somedir/test.jl")
end
end # testset

@testset "isfuncexpr" begin
@test CoverageTools.isfuncexpr(:(f() = x))
Expand All @@ -43,7 +37,7 @@ end
@test CoverageTools.isfuncexpr(:(x -> x))
@test CoverageTools.isfuncexpr(:(f() where A = x))
@test CoverageTools.isfuncexpr(:(f() where A where B = x))
end
end # testset

@testset "Processing coverage" begin
cd(dirname(@__DIR__)) do
Expand Down Expand Up @@ -204,9 +198,12 @@ end
msg = "parsing error in $bustedfile:7: invalid iteration specification"
end
@test_throws Base.Meta.ParseError(msg) process_file(bustedfile, srcdir)

end

end # of withenv("DISABLE_AMEND_COVERAGE_FROM_SRC" => nothing)

end # of @testset "CoverageTools"
end # testset

@testset "types" begin
a = CoverageTools.MallocInfo(1, "", 1)
b = CoverageTools.MallocInfo(2, "", 1)
@test CoverageTools.sortbybytes(a, b)
end # testset

end # withenv

2 comments on commit 682b616

@DilumAluthge
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/38438

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.2.4 -m "<description of version>" 682b616f55702484ed8213cf3ec06fde695212b3
git push origin v1.2.4

Please sign in to comment.