Organize interactive tests

This commit is contained in:
Chris de Graaf 2017-10-01 22:21:35 -05:00
parent be491944b5
commit 465614d17b
4 changed files with 107 additions and 2 deletions

View File

@ -37,6 +37,9 @@
# Like above, not sure which plugins this will generate.
@test length(t.plugins) == 2
write(STDIN.buffer, "$me\n\n\r\n\n\nA B\n A B\n\nd")
@test_warn r".+" interactive_template()
write(STDIN.buffer, "$me\nd")
t = interactive_template(; fast=true)
@test t.user == me
@ -52,3 +55,10 @@
@test isempty(t.plugins)
println()
end
@testset "Interactive package generation" begin
write(STDIN.buffer, "$me\n\n\r\n\n\n\nd")
generate_interactive(test_pkg)
@test isdir(Pkg.dir(test_pkg))
rm(Pkg.dir(test_pkg); force=true, recursive=true)
end

View File

@ -0,0 +1,88 @@
@testset "TravisCI" begin
write(STDIN.buffer, "\n")
p = interactive(TravisCI)
@test get(p.src) == joinpath(DEFAULTS_DIR, "travis.yml")
write(STDIN.buffer, "$test_file\n")
p = interactive(TravisCI)
@test get(p.src) == test_file
write(STDIN.buffer, "none\n")
p = interactive(TravisCI)
@test isnull(p.src)
write(STDIN.buffer, "$fake_path\n")
@test_throws ArgumentError interactive(TravisCI)
println()
end
@testset "AppVeyor" begin
write(STDIN.buffer, "\n")
p = interactive(AppVeyor)
@test get(p.src) == joinpath(DEFAULTS_DIR, "appveyor.yml")
write(STDIN.buffer, "$test_file\n")
p = interactive(AppVeyor)
@test get(p.src) == test_file
write(STDIN.buffer, "none\n")
p = interactive(AppVeyor)
@test isnull(p.src)
write(STDIN.buffer, "$fake_path\n")
@test_throws ArgumentError interactive(AppVeyor)
println()
end
@testset "GitLabCI" begin
write(STDIN.buffer, "\n\n")
p = interactive(GitLabCI)
@test get(p.src) == joinpath(DEFAULTS_DIR, "gitlab-ci.yml")
@test p.view == Dict("GITLABCOVERAGE" => true)
write(STDIN.buffer, "$test_file\nno\n")
p = interactive(GitLabCI)
@test get(p.src) == test_file
@test p.view == Dict("GITLABCOVERAGE" => false)
write(STDIN.buffer, "none\n\n")
p = interactive(GitLabCI)
@test isnull(p.src)
write(STDIN.buffer, "$fake_path\n\n")
@test_throws ArgumentError interactive(GitLabCI)
println()
end
@testset "CodeCov" begin
write(STDIN.buffer, "\n")
p = interactive(CodeCov)
@test get(p.src) == joinpath(DEFAULTS_DIR, "codecov.yml")
write(STDIN.buffer, "$test_file\n")
p = interactive(CodeCov)
@test get(p.src) == test_file
write(STDIN.buffer, "none\n")
p = interactive(CodeCov)
@test isnull(p.src)
write(STDIN.buffer, "$fake_path\n")
@test_throws ArgumentError interactive(CodeCov)
println()
end
@testset "Coveralls" begin
write(STDIN.buffer, "\n")
p = interactive(Coveralls)
@test isnull(p.src)
write(STDIN.buffer, "$test_file\n")
p = interactive(Coveralls)
@test get(p.src) == test_file
write(STDIN.buffer, "none\n")
p = interactive(Coveralls)
@test isnull(p.src)
write(STDIN.buffer, "$fake_path\n")
@test_throws ArgumentError interactive(Coveralls)
println()
end
@testset "GitHubPages" begin
write(STDIN.buffer, "\n")
p = interactive(GitHubPages)
@test isempty(p.assets)
write(STDIN.buffer, "$test_file\n")
p = interactive(GitHubPages)
@test p.assets == [test_file]
write(STDIN.buffer, "$fake_path\n")
@test_throws ArgumentError interactive(GitHubPages)
println()
end

View File

@ -3,7 +3,8 @@ using Base.Test
import PkgTemplates: badges, version_floor, substitute, read_license, gen_file, gen_readme,
gen_tests, gen_license, gen_require, gen_entrypoint, gen_gitignore, gen_plugin,
show_license, LICENSES, LICENSE_DIR, Plugin, GenericPlugin, CustomPlugin, Badge, format
show_license, LICENSES, LICENSE_DIR, Plugin, GenericPlugin, CustomPlugin, Badge,
format, interactive, DEFAULTS_DIR
mktempdir() do temp_dir
withenv("JULIA_PKGDIR" => temp_dir) do

View File

@ -114,8 +114,14 @@ write(test_file, template_text)
end
if get(ENV, "TRAVIS_OS_NAME", "") != "osx"
include("interactive.jl")
include(joinpath("interactive", "interactive.jl"))
else
info("Skipping tests that require TerminalMenus")
end
@testset "Interactive plugin creation" begin
include(joinpath("interactive", "plugins.jl"))
end
@testset "File generation" begin
t = Template(;