PkgTemplates.jl/test/plugins/codecov.jl

43 lines
1.4 KiB
Julia
Raw Normal View History

2017-10-02 01:43:03 +00:00
user = gitconfig["github.user"]
t = Template(; user=me)
temp_dir = mktempdir()
pkg_dir = joinpath(temp_dir, test_pkg)
@testset "CodeCov" begin
@testset "Plugin creation" begin
p = CodeCov()
@test p.gitignore == ["*.jl.cov", "*.jl.*.cov", "*.jl.mem"]
2017-10-27 15:47:56 +00:00
@test isnull(p.src)
2017-10-02 01:43:03 +00:00
@test p.dest == ".codecov.yml"
@test p.badges == [
Badge(
"CodeCov",
"https://codecov.io/gh/{{USER}}/{{PKGNAME}}.jl/branch/master/graph/badge.svg",
"https://codecov.io/gh/{{USER}}/{{PKGNAME}}.jl",
)
]
@test isempty(p.view)
p = CodeCov(; config_file=nothing)
@test isnull(p.src)
p = CodeCov(; config_file=test_file)
2017-10-02 03:27:28 +00:00
@test get(p.src, "") == test_file
2017-10-02 01:43:03 +00:00
@test_throws ArgumentError CodeCov(; config_file=fake_path)
end
@testset "Badge generation" begin
p = CodeCov()
@test badges(p, user, test_pkg) == ["[![CodeCov](https://codecov.io/gh/$user/$test_pkg.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/$user/$test_pkg.jl)"]
end
@testset "File generation" begin
p = CodeCov()
2017-10-27 15:47:56 +00:00
@test isempty(gen_plugin(p, t, temp_dir, test_pkg))
@test !isfile(joinpath(pkg_dir, ".codecov.yml"))
2017-10-02 01:43:03 +00:00
p = CodeCov(; config_file=nothing)
@test isempty(gen_plugin(p, t, temp_dir, test_pkg))
@test !isfile(joinpath(pkg_dir, ".codecov.yml"))
end
end
rm(temp_dir; recursive=true)