Add a test for the test/Project.toml warning

This commit is contained in:
Chris de Graaf 2019-10-06 16:55:54 +07:00
parent ca51806cf6
commit 69a7c5c68b
No known key found for this signature in database
GPG Key ID: 150FFDD9B0073C7B
2 changed files with 9 additions and 1 deletions

View File

@ -29,7 +29,7 @@ function validate(p::Tests, t::Template)
invoke(validate, Tuple{BasicPlugin, Template}, p, t)
p.project && t.julia < v"1.2" && @warn string(
"Tests: The project option is set to create a project (supported in Julia 1.2 and later) ",
"but a Julia version older than 1.2 is supported by the Template",
"but a Julia version older than 1.2 ($(t.julia)) is supported by the template",
)
end

View File

@ -26,4 +26,12 @@ PT.user_view(::BasicTest, ::Template, ::AbstractString) = Dict("X" => 1, "Z" =>
@test read(joinpath(pkg_dir, "foo.txt"), String) == s
end
end
@testset "Tests Project.toml warning on Julia < 1.2" begin
p = Tests(; project=true)
@test_logs (:warn, r"The project option is set") tpl(; julia=v"1", plugins=[p])
@test_logs (:warn, r"The project option is set") tpl(; julia=v"1.1", plugins=[p])
@test_logs tpl(; julia=v"1.2", plugins=[p])
@test_logs tpl(; julia=v"1.3", plugins=[p])
end
end