tests passing

This commit is contained in:
Mathieu Besançon 2019-05-14 21:31:34 +02:00
parent 65dbc13dad
commit 0631dc6be6
4 changed files with 33 additions and 2 deletions

View File

@ -24,7 +24,8 @@ export
TravisCI, TravisCI,
GitLabCI, GitLabCI,
Codecov, Codecov,
Coveralls Coveralls,
Citation
""" """
A plugin to be added to a [`Template`](@ref), which adds some functionality or integration. A plugin to be added to a [`Template`](@ref), which adds some functionality or integration.

View File

@ -31,7 +31,7 @@ interactive(::Type{Citation}) = interactive(Citation; readme_section=false)
function gen_plugin(p::Citation, t::Template, pkg_name::AbstractString) function gen_plugin(p::Citation, t::Template, pkg_name::AbstractString)
pkg_dir = joinpath(t.dir, pkg_name) pkg_dir = joinpath(t.dir, pkg_name)
text = """@misc{$pkg_name.jl, text = """@misc{$pkg_name.jl,
\tauthor = {{$(t.author)}},\n \tauthor = {{$(t.authors)}},\n
\ttitle = {{$(pkg_name).jl}},\n \ttitle = {{$(pkg_name).jl}},\n
\turl = {https://$(t.host)/$(t.user)/$(pkg_name).jl},\n \turl = {https://$(t.host)/$(t.user)/$(pkg_name).jl},\n
\tversion = {v0.0.1},\n \tversion = {v0.0.1},\n

29
test/plugins/citation.jl Normal file
View File

@ -0,0 +1,29 @@
t = Template(; user=me)
pkg_dir = joinpath(t.dir, test_pkg)
@testset "CITATION" begin
@testset "Plugin creation" begin
p = Citation()
@test isempty(p.gitignore)
@test p.dest == "CITATION.bib"
@test isempty(p.badges)
@test isempty(p.view)
@test !p.readme_section
p = Citation(; readme_section=true)
@test p.readme_section
end
@testset "File generation" begin
# Without a coverage plugin in the template, there should be no post-test step.
p = Citation()
@test gen_plugin(p, t, test_pkg) == ["CITATION.bib"]
@test isfile(joinpath(pkg_dir, "CITATION.bib"))
citation = read(joinpath(pkg_dir, "CITATION.bib"), String)
@test occursin("@misc", citation)
@test occursin("$(t.authors)", citation)
@test occursin("v0.0.1", citation)
end
end
rm(pkg_dir; recursive=true)

View File

@ -445,6 +445,7 @@ end
include(joinpath("plugins", "coveralls.jl")) include(joinpath("plugins", "coveralls.jl"))
include(joinpath("plugins", "githubpages.jl")) include(joinpath("plugins", "githubpages.jl"))
include(joinpath("plugins", "gitlabpages.jl")) include(joinpath("plugins", "gitlabpages.jl"))
include(joinpath("plugins", "citation.jl"))
end end
@testset "Documenter add kwargs" begin @testset "Documenter add kwargs" begin