30 lines
1.1 KiB
Julia
30 lines
1.1 KiB
Julia
# Don't move this line from the top, please. {{X}} {{Y}} {{Z}}
|
|
|
|
struct BasicTest <: PT.BasicPlugin end
|
|
|
|
PT.gitignore(::BasicTest) = ["a", "aa", "aaa"]
|
|
PT.source(::BasicTest) = @__FILE__
|
|
PT.destination(::BasicTest) = "foo.txt"
|
|
PT.badges(::BasicTest) = PT.Badge("{{X}}", "{{Y}}", "{{Z}}")
|
|
PT.view(::BasicTest, ::Template, ::AbstractString) = Dict("X" => 0, "Y" => 2)
|
|
PT.user_view(::BasicTest, ::Template, ::AbstractString) = Dict("X" => 1, "Z" => 3)
|
|
|
|
@testset "Plugins" begin
|
|
@testset "BasicPlugin" begin
|
|
p = BasicTest()
|
|
t = tpl(; plugins=[p])
|
|
|
|
# The X from user_view should override the X from view.
|
|
s = PT.render_plugin(p, t, "")
|
|
@test occursin("1 2 3", first(split(s, "\n")))
|
|
|
|
with_pkg(t) do pkg
|
|
pkg_dir = joinpath(t.dir, pkg)
|
|
badge = string(PT.Badge("1", "2", "3"))
|
|
@test occursin("a\naa\naaa", read(joinpath(pkg_dir, ".gitignore"), String))
|
|
@test occursin(badge, read(joinpath(pkg_dir, "README.md"), String))
|
|
@test read(joinpath(pkg_dir, "foo.txt"), String) == s
|
|
end
|
|
end
|
|
end
|