Use two-argument form of get in tests

This commit is contained in:
Chris de Graaf 2017-10-01 22:27:28 -05:00
parent 465614d17b
commit 59579392ed
6 changed files with 18 additions and 18 deletions

View File

@ -1,10 +1,10 @@
@testset "TravisCI" begin @testset "TravisCI" begin
write(STDIN.buffer, "\n") write(STDIN.buffer, "\n")
p = interactive(TravisCI) p = interactive(TravisCI)
@test get(p.src) == joinpath(DEFAULTS_DIR, "travis.yml") @test get(p.src, "") == joinpath(DEFAULTS_DIR, "travis.yml")
write(STDIN.buffer, "$test_file\n") write(STDIN.buffer, "$test_file\n")
p = interactive(TravisCI) p = interactive(TravisCI)
@test get(p.src) == test_file @test get(p.src, "") == test_file
write(STDIN.buffer, "none\n") write(STDIN.buffer, "none\n")
p = interactive(TravisCI) p = interactive(TravisCI)
@test isnull(p.src) @test isnull(p.src)
@ -16,10 +16,10 @@ end
@testset "AppVeyor" begin @testset "AppVeyor" begin
write(STDIN.buffer, "\n") write(STDIN.buffer, "\n")
p = interactive(AppVeyor) p = interactive(AppVeyor)
@test get(p.src) == joinpath(DEFAULTS_DIR, "appveyor.yml") @test get(p.src, "") == joinpath(DEFAULTS_DIR, "appveyor.yml")
write(STDIN.buffer, "$test_file\n") write(STDIN.buffer, "$test_file\n")
p = interactive(AppVeyor) p = interactive(AppVeyor)
@test get(p.src) == test_file @test get(p.src, "") == test_file
write(STDIN.buffer, "none\n") write(STDIN.buffer, "none\n")
p = interactive(AppVeyor) p = interactive(AppVeyor)
@test isnull(p.src) @test isnull(p.src)
@ -31,11 +31,11 @@ end
@testset "GitLabCI" begin @testset "GitLabCI" begin
write(STDIN.buffer, "\n\n") write(STDIN.buffer, "\n\n")
p = interactive(GitLabCI) p = interactive(GitLabCI)
@test get(p.src) == joinpath(DEFAULTS_DIR, "gitlab-ci.yml") @test get(p.src, "") == joinpath(DEFAULTS_DIR, "gitlab-ci.yml")
@test p.view == Dict("GITLABCOVERAGE" => true) @test p.view == Dict("GITLABCOVERAGE" => true)
write(STDIN.buffer, "$test_file\nno\n") write(STDIN.buffer, "$test_file\nno\n")
p = interactive(GitLabCI) p = interactive(GitLabCI)
@test get(p.src) == test_file @test get(p.src, "") == test_file
@test p.view == Dict("GITLABCOVERAGE" => false) @test p.view == Dict("GITLABCOVERAGE" => false)
write(STDIN.buffer, "none\n\n") write(STDIN.buffer, "none\n\n")
p = interactive(GitLabCI) p = interactive(GitLabCI)
@ -48,10 +48,10 @@ end
@testset "CodeCov" begin @testset "CodeCov" begin
write(STDIN.buffer, "\n") write(STDIN.buffer, "\n")
p = interactive(CodeCov) p = interactive(CodeCov)
@test get(p.src) == joinpath(DEFAULTS_DIR, "codecov.yml") @test get(p.src, "") == joinpath(DEFAULTS_DIR, "codecov.yml")
write(STDIN.buffer, "$test_file\n") write(STDIN.buffer, "$test_file\n")
p = interactive(CodeCov) p = interactive(CodeCov)
@test get(p.src) == test_file @test get(p.src, "") == test_file
write(STDIN.buffer, "none\n") write(STDIN.buffer, "none\n")
p = interactive(CodeCov) p = interactive(CodeCov)
@test isnull(p.src) @test isnull(p.src)
@ -66,7 +66,7 @@ end
@test isnull(p.src) @test isnull(p.src)
write(STDIN.buffer, "$test_file\n") write(STDIN.buffer, "$test_file\n")
p = interactive(Coveralls) p = interactive(Coveralls)
@test get(p.src) == test_file @test get(p.src, "") == test_file
write(STDIN.buffer, "none\n") write(STDIN.buffer, "none\n")
p = interactive(Coveralls) p = interactive(Coveralls)
@test isnull(p.src) @test isnull(p.src)

View File

@ -7,7 +7,7 @@ pkg_dir = joinpath(temp_dir, test_pkg)
@testset "Plugin creation" begin @testset "Plugin creation" begin
p = AppVeyor() p = AppVeyor()
@test isempty(p.gitignore) @test isempty(p.gitignore)
@test get(p.src) == joinpath(PkgTemplates.DEFAULTS_DIR, "appveyor.yml") @test get(p.src, "") == joinpath(PkgTemplates.DEFAULTS_DIR, "appveyor.yml")
@test p.dest == ".appveyor.yml" @test p.dest == ".appveyor.yml"
@test p.badges == [ @test p.badges == [
Badge( Badge(
@ -20,7 +20,7 @@ pkg_dir = joinpath(temp_dir, test_pkg)
p = AppVeyor(; config_file=nothing) p = AppVeyor(; config_file=nothing)
@test isnull(p.src) @test isnull(p.src)
p = AppVeyor(; config_file=test_file) p = AppVeyor(; config_file=test_file)
@test get(p.src) == test_file @test get(p.src, "") == test_file
@test_throws ArgumentError AppVeyor(; config_file=fake_path) @test_throws ArgumentError AppVeyor(; config_file=fake_path)
end end

View File

@ -7,7 +7,7 @@ pkg_dir = joinpath(temp_dir, test_pkg)
@testset "Plugin creation" begin @testset "Plugin creation" begin
p = CodeCov() p = CodeCov()
@test p.gitignore == ["*.jl.cov", "*.jl.*.cov", "*.jl.mem"] @test p.gitignore == ["*.jl.cov", "*.jl.*.cov", "*.jl.mem"]
@test get(p.src) == joinpath(PkgTemplates.DEFAULTS_DIR, "codecov.yml") @test get(p.src, "") == joinpath(PkgTemplates.DEFAULTS_DIR, "codecov.yml")
@test p.dest == ".codecov.yml" @test p.dest == ".codecov.yml"
@test p.badges == [ @test p.badges == [
Badge( Badge(
@ -20,7 +20,7 @@ pkg_dir = joinpath(temp_dir, test_pkg)
p = CodeCov(; config_file=nothing) p = CodeCov(; config_file=nothing)
@test isnull(p.src) @test isnull(p.src)
p = CodeCov(; config_file=test_file) p = CodeCov(; config_file=test_file)
@test get(p.src) == test_file @test get(p.src, "") == test_file
@test_throws ArgumentError CodeCov(; config_file=fake_path) @test_throws ArgumentError CodeCov(; config_file=fake_path)
end end

View File

@ -20,7 +20,7 @@ pkg_dir = joinpath(temp_dir, test_pkg)
p = Coveralls(; config_file=nothing) p = Coveralls(; config_file=nothing)
@test isnull(p.src) @test isnull(p.src)
p = Coveralls(; config_file=test_file) p = Coveralls(; config_file=test_file)
@test get(p.src) == test_file @test get(p.src, "") == test_file
@test_throws ArgumentError Coveralls(; config_file=fake_path) @test_throws ArgumentError Coveralls(; config_file=fake_path)
end end

View File

@ -7,7 +7,7 @@ pkg_dir = joinpath(temp_dir, test_pkg)
@testset "Plugin creation" begin @testset "Plugin creation" begin
p = GitLabCI() p = GitLabCI()
@test p.gitignore == ["*.jl.cov", "*.jl.*.cov", "*.jl.mem"] @test p.gitignore == ["*.jl.cov", "*.jl.*.cov", "*.jl.mem"]
@test get(p.src) == joinpath(PkgTemplates.DEFAULTS_DIR, "gitlab-ci.yml") @test get(p.src, "") == joinpath(PkgTemplates.DEFAULTS_DIR, "gitlab-ci.yml")
@test p.dest == ".gitlab-ci.yml" @test p.dest == ".gitlab-ci.yml"
@test p.badges == [ @test p.badges == [
Badge( Badge(
@ -25,7 +25,7 @@ pkg_dir = joinpath(temp_dir, test_pkg)
p = GitLabCI(; config_file=nothing) p = GitLabCI(; config_file=nothing)
@test isnull(p.src) @test isnull(p.src)
p = GitLabCI(; config_file=test_file) p = GitLabCI(; config_file=test_file)
@test get(p.src) == test_file @test get(p.src, "") == test_file
@test_throws ArgumentError GitLabCI(; config_file=fake_path) @test_throws ArgumentError GitLabCI(; config_file=fake_path)
p = GitLabCI(; coverage=false) p = GitLabCI(; coverage=false)
@test p.badges == [ @test p.badges == [

View File

@ -7,7 +7,7 @@ pkg_dir = joinpath(temp_dir, test_pkg)
@testset "Plugin creation" begin @testset "Plugin creation" begin
p = TravisCI() p = TravisCI()
@test isempty(p.gitignore) @test isempty(p.gitignore)
@test get(p.src) == joinpath(PkgTemplates.DEFAULTS_DIR, "travis.yml") @test get(p.src, "") == joinpath(PkgTemplates.DEFAULTS_DIR, "travis.yml")
@test p.dest == ".travis.yml" @test p.dest == ".travis.yml"
@test p.badges == [ @test p.badges == [
Badge( Badge(
@ -20,7 +20,7 @@ pkg_dir = joinpath(temp_dir, test_pkg)
p = TravisCI(; config_file=nothing) p = TravisCI(; config_file=nothing)
@test isnull(p.src) @test isnull(p.src)
p = TravisCI(; config_file=test_file) p = TravisCI(; config_file=test_file)
@test get(p.src) == test_file @test get(p.src, "") == test_file
@test_throws ArgumentError TravisCI(; config_file=fake_path) @test_throws ArgumentError TravisCI(; config_file=fake_path)
end end