PkgTemplates.jl/test/reference.jl

32 lines
1.0 KiB
Julia
Raw Normal View History

2019-08-31 11:45:41 +00:00
# TODO: License fixtures need to be updated every year because they don't use Mustache.
2019-08-31 10:33:33 +00:00
2019-08-31 11:45:41 +00:00
function PT.user_view(::Citation, ::Template, ::AbstractString)
return Dict("MONTH" => 8, "YEAR" => 2019)
2019-08-31 10:33:33 +00:00
end
2019-08-31 11:45:41 +00:00
function test_all(pkg::AbstractString; kwargs...)
t = tpl(; kwargs...)
2019-09-01 01:36:33 +00:00
with_pkg(t, pkg) do pkg
pkg_dir = joinpath(t.dir, pkg)
2019-08-31 11:45:41 +00:00
foreach(readlines(`git -C $pkg_dir ls-files`)) do f
2019-08-31 14:09:22 +00:00
# All fixture files are .txt so that ReferenceTests can handle them.
2019-08-31 11:45:41 +00:00
reference = joinpath(@__DIR__, "fixtures", pkg, f * ".txt")
observed = read(joinpath(pkg_dir, f), String)
@test_reference reference observed
end
end
end
@testset "Reference tests" begin
@testset "Default package" begin
test_all("Basic"; authors=USER, manifest=true)
end
2019-08-31 11:45:41 +00:00
@testset "All plugins" begin
test_all("AllPlugins"; authors=USER, manifest=true, plugins=[
AppVeyor(), CirrusCI(), Citation(), Codecov(),
Coveralls(), Documenter(), GitLabCI(), TravisCI(),
])
end
2019-08-31 10:33:33 +00:00
end