PkgTemplates.jl/test/show.jl

71 lines
2.5 KiB
Julia
Raw Normal View History

const TEMPLATES_DIR = contractuser(PT.TEMPLATES_DIR)
const LICENSES_DIR = joinpath(TEMPLATES_DIR, "licenses")
2019-09-02 14:20:33 +00:00
@testset "Show methods" begin
@testset "Plugins" begin
expected = """
Readme:
file: "$(joinpath(TEMPLATES_DIR, "README.md"))"
2019-09-02 14:20:33 +00:00
destination: "README.md"
inline_badges: false
"""
@test sprint(show, MIME("text/plain"), Readme()) == rstrip(expected)
2019-09-02 14:20:33 +00:00
end
@testset "Template" begin
expected = """
Template:
authors: ["$USER"]
dir: "$(contractuser(Pkg.devdir()))"
2019-09-02 14:20:33 +00:00
host: "github.com"
2019-09-25 13:48:39 +00:00
julia: v"1.0.0"
2019-09-02 14:20:33 +00:00
user: "$USER"
plugins:
CompatHelper:
file: "$(joinpath(TEMPLATES_DIR, "github", "workflows", "CompatHelper.yml"))"
destination: "CompatHelper.yml"
Git:
ignore: String[]
ssh: false
manifest: false
gpgsign: false
2019-09-02 14:20:33 +00:00
License:
path: "$(joinpath(LICENSES_DIR, "MIT"))"
2019-09-02 14:20:33 +00:00
destination: "LICENSE"
ProjectFile:
version: v"0.1.0"
Readme:
file: "$(joinpath(TEMPLATES_DIR, "README.md"))"
destination: "README.md"
inline_badges: false
SrcDir:
file: "$(joinpath(TEMPLATES_DIR, "src", "module.jl"))"
2019-11-02 13:16:47 +00:00
TagBot:
file: "$(joinpath(TEMPLATES_DIR, "github", "workflows", "TagBot.yml"))"
2019-11-02 13:16:47 +00:00
destination: "TagBot.yml"
cron: "0 * * * *"
token: Secret("GITHUB_TOKEN")
ssh: nothing
ssh_password: nothing
changelog: nothing
changelog_ignore: nothing
gpg: nothing
gpg_password: nothing
2019-11-12 11:17:58 +00:00
registry: nothing
branches: nothing
dispatch: nothing
dispatch_delay: nothing
Tests:
file: "$(joinpath(TEMPLATES_DIR, "test", "runtests.jl"))"
project: false
2019-09-02 14:20:33 +00:00
"""
@test sprint(show, MIME("text/plain"), tpl(; authors=USER)) == rstrip(expected)
end
@testset "show as serialization" begin
t1 = tpl()
t2 = eval(Meta.parse(sprint(show, t1)))
@test t1 == t2
2019-09-02 14:20:33 +00:00
end
end