Adds tests
This commit is contained in:
parent
f0ed4cca98
commit
eb356e0ec9
@ -32,8 +32,8 @@ function gen_plugin(p::Documenter, t::Template, pkg_name::AbstractString)
|
||||
"[]"
|
||||
end
|
||||
|
||||
kwargs_string = if "additional_kwargs" in fieldnames(typeof(p))
|
||||
const set_kwargs = ["modules", "format", "pages", "repo", "sitename", "authors", "assets"]
|
||||
kwargs_string = if :additional_kwargs in fieldnames(typeof(p))
|
||||
set_kwargs = ["modules", "format", "pages", "repo", "sitename", "authors", "assets"]
|
||||
|
||||
# We want something that looks like the following:
|
||||
# key1="val1",
|
||||
|
@ -7,7 +7,7 @@ using Pkg
|
||||
import PkgTemplates: badges, version_floor, substitute, read_license, gen_file, gen_readme,
|
||||
gen_tests, gen_license, gen_require, gen_gitignore, gen_plugin, show_license, LICENSES,
|
||||
LICENSE_DIR, Plugin, GenericPlugin, CustomPlugin, Badge, format, interactive,
|
||||
DEFAULTS_DIR
|
||||
DEFAULTS_DIR, Documenter
|
||||
|
||||
mktempdir() do temp_dir
|
||||
mkdir(joinpath(temp_dir, "dev"))
|
||||
|
@ -13,6 +13,11 @@ end
|
||||
struct Bar <: CustomPlugin end
|
||||
# A dummy Plugin subtype.
|
||||
struct Baz <: Plugin end
|
||||
# A Documenter with extra kwargs
|
||||
struct Bat <: Documenter
|
||||
assets::Vector{AbstractString}
|
||||
additional_kwargs::Vector{<:Pair}
|
||||
end
|
||||
|
||||
# Various options to be passed into templates.
|
||||
const me = "christopher-dG"
|
||||
@ -397,4 +402,26 @@ end
|
||||
include(joinpath("plugins", "githubpages.jl"))
|
||||
end
|
||||
|
||||
@testset "Documenter add kwargs" begin
|
||||
t = Template(; user=me)
|
||||
pkg_dir = joinpath(t.dir, test_pkg)
|
||||
p = Bat(
|
||||
[],
|
||||
["strict"=>true, "checkdocs"=>:none, "format"=>:markdown, "stringarg"=>"string"]
|
||||
)
|
||||
gen_plugin(p, t, test_pkg)
|
||||
make = readchomp(joinpath(pkg_dir, "docs", "make.jl"))
|
||||
@test occursin(
|
||||
strip("""
|
||||
strict=true,
|
||||
checkdocs=:none,
|
||||
stringarg="string",
|
||||
"""),
|
||||
make,
|
||||
)
|
||||
@test !occursin("format=:markdown", make)
|
||||
@test occursin("format=:html", make)
|
||||
rm(pkg_dir; recursive=true)
|
||||
end
|
||||
|
||||
rm(test_file)
|
||||
|
Loading…
Reference in New Issue
Block a user