Don't redirect STDIN

This commit is contained in:
Chris de Graaf 2017-08-24 10:35:15 -05:00
parent 2af2407881
commit 3ff1fbcd73

View File

@ -110,9 +110,7 @@ write(test_file, template_text)
end end
@testset "Interactive template creation" begin @testset "Interactive template creation" begin
old_stdin = STDIN write(STDIN.buffer, "$me\n\n\r\n\n\n\n\n\nd")
in_read, in_write = redirect_stdin()
write(in_write, "$me\n\n\r\n\n\n\n\n\nd")
t = interactive_template() t = interactive_template()
@test t.user == me @test t.user == me
@test t.host == "github.com" @test t.host == "github.com"
@ -126,11 +124,11 @@ end
@test isempty(t.plugins) @test isempty(t.plugins)
if isempty(LibGit2.getconfig("github.user", "")) if isempty(LibGit2.getconfig("github.user", ""))
write(in_write, "\n") write(STDIN.buffer, "\n")
@test_throws ArgumentError t = interactive_template() @test_throws ArgumentError t = interactive_template()
end end
write(in_write, "$me\ngitlab.com\n$('\x1b')[B\r$me\n2016\n$test_file\n0.5\nX Y\nA B\n\n$('\x1b')[B\r$('\x1b')[B\rd\n\n") write(STDIN.buffer, "$me\ngitlab.com\n$('\x1b')[B\r$me\n2016\n$test_file\n0.5\nX Y\nA B\n\n$('\x1b')[B\r$('\x1b')[B\rd\n\n")
t = interactive_template() t = interactive_template()
@test t.user == me @test t.user == me
@test t.host == "gitlab.com" @test t.host == "gitlab.com"
@ -145,7 +143,7 @@ end
# Like above, not sure which plugins this will generate. # Like above, not sure which plugins this will generate.
@test length(t.plugins) == 2 @test length(t.plugins) == 2
write(in_write, "$me\nd") write(STDIN.buffer, "$me\nd")
t = interactive_template(; fast=true) t = interactive_template(; fast=true)
@test t.user == me @test t.user == me
@test t.host == "github.com" @test t.host == "github.com"
@ -158,8 +156,6 @@ end
@test isempty(t.requirements) @test isempty(t.requirements)
@test isempty(t.gitconfig) @test isempty(t.gitconfig)
@test isempty(t.plugins) @test isempty(t.plugins)
redirect_stdin(old_stdin)
println() println()
end end