PkgTemplates.jl/test/interactive/interactive.jl

66 lines
2.2 KiB
Julia
Raw Normal View History

2018-11-05 20:21:02 +00:00
@testset "Interactive mode" begin
@testset "Template creation" begin
2018-11-07 20:46:44 +00:00
write(stdin.buffer, "$me\n\n\r\n\n\n\nd")
2018-11-05 20:21:02 +00:00
t = interactive_template()
@test t.user == me
@test t.host == "github.com"
@test isempty(t.license)
@test t.authors == LibGit2.getconfig("user.name", "")
@test t.dir == default_dir
@test t.julia_version == VERSION
@test !t.ssh
@test isempty(t.plugins)
2018-11-05 20:21:02 +00:00
if isempty(LibGit2.getconfig("github.user", ""))
write(stdin.buffer, "\n")
@test_throws ArgumentError t = interactive_template()
end
2018-11-05 20:21:02 +00:00
down = '\x1b' * "[B" # Down array key.
2018-11-07 20:46:44 +00:00
write(stdin.buffer, "$me\ngitlab.com\n$down\r$me\n$test_file\n0.5\nyes\nyes\n$down\r$down\rd\n\n")
2018-11-05 20:21:02 +00:00
t = interactive_template()
@test t.user == me
@test t.host == "gitlab.com"
# Not sure if the order the licenses are displayed in is consistent.
@test !isempty(t.license)
@test t.authors == me
@test t.dir == abspath(test_file)
@test t.julia_version == v"0.5.0"
@test t.ssh
2018-11-07 20:46:44 +00:00
@test t.manifest
2018-11-05 20:21:02 +00:00
# Like above, not sure which plugins this will generate.
@test length(t.plugins) == 2
2018-11-05 20:21:02 +00:00
write(stdin.buffer, "$me\nd")
t = interactive_template(; fast=true)
@test t.user == me
@test t.host == "github.com"
@test t.license == "MIT"
@test t.authors == LibGit2.getconfig("user.name", "")
@test t.dir == default_dir
@test t.julia_version == VERSION
@test !t.ssh
2018-11-07 20:46:44 +00:00
@test !t.manifest
2018-11-05 20:21:02 +00:00
@test isempty(t.plugins)
println()
2018-11-09 20:51:51 +00:00
# Host and SSH aren't prompted for when git is disabled.
2018-11-12 21:31:41 +00:00
write(stdin.buffer, "$me\n\n\r\n\n\nd")
2018-11-09 20:51:51 +00:00
t = interactive_template(; git=false)
@test t.host == "github.com"
@test !t.ssh
println()
2018-11-05 20:21:02 +00:00
end
2018-11-05 20:21:02 +00:00
@testset "Package generation" begin
2018-11-07 20:46:44 +00:00
write(stdin.buffer, "$me\n\n\r\n\n\n\n\n\n\nd")
2018-11-05 20:21:02 +00:00
generate_interactive(test_pkg; gitconfig=gitconfig)
@test isdir(joinpath(default_dir, test_pkg))
rm(joinpath(default_dir, test_pkg); force=true, recursive=true)
end
2017-10-02 03:21:35 +00:00
2018-11-05 20:21:02 +00:00
@testset "Plugins" begin
include("plugins.jl")
end
2017-10-02 03:21:35 +00:00
end