From 445007b96bce90b9d8e04b3eee12502501d4456b Mon Sep 17 00:00:00 2001 From: Chris de Graaf Date: Thu, 19 Sep 2019 07:58:48 +0700 Subject: [PATCH] Fix a Windows test, maybe --- src/interactive.jl | 6 +++++- src/template.jl | 2 +- test/show.jl | 8 ++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/interactive.jl b/src/interactive.jl index a7d513f9..9b343567 100644 --- a/src/interactive.jl +++ b/src/interactive.jl @@ -13,7 +13,11 @@ function Base.show(io::IO, ::MIME"text/plain", p::T) where T <: Plugin end show_field(x) = repr(x) -show_field(x::AbstractString) = repr(contractuser(x)) +if Sys.iswindows() + show_field(x::AbstractString) = replace(repr(contractuser(x)), "\\\\" => "\\") +else + show_field(x::AbstractString) = repr(contractuser(x)) +end function Base.show(io::IO, m::MIME"text/plain", t::Template) println(io, "Template:") diff --git a/src/template.jl b/src/template.jl index da175bf2..7350a991 100644 --- a/src/template.jl +++ b/src/template.jl @@ -90,7 +90,7 @@ function Template(::Val{false}; kwargs...) plugins = Dict(typeof(p) => p for p in enabled) # TODO: It might be nice to offer some kind of warn_incompatible function - # to be optionally implented by plugins instead of hardcoding this case here. + # to be optionally implemented by plugins instead of hardcoding this case here. julia = getkw(kwargs, :julia_version) julia < v"1.2" && haskey(plugins, Tests) && plugins[Tests].project && @warn string( "The Tests plugin is set to create a project (supported in Julia 1.2 and later)", diff --git a/test/show.jl b/test/show.jl index b48fe7ff..b97c3afe 100644 --- a/test/show.jl +++ b/test/show.jl @@ -5,7 +5,7 @@ const LICENSE_DIR = contractuser(PT.LICENSE_DIR) @testset "Plugins" begin expected = """ Readme: - file: "$DEFAULTS_DIR/README.md" + file: "$(joinpath(DEFAULTS_DIR, "README.md"))" destination: "README.md" inline_badges: false """ @@ -29,14 +29,14 @@ const LICENSE_DIR = contractuser(PT.LICENSE_DIR) ds_store: true dev: true License: - path: "$LICENSE_DIR/MIT" + path: "$(joinpath(LICENSE_DIR, "MIT"))" destination: "LICENSE" Readme: - file: "$DEFAULTS_DIR/README.md" + file: "$(joinpath(DEFAULTS_DIR, "README.md"))" destination: "README.md" inline_badges: false Tests: - file: "$DEFAULTS_DIR/runtests.jl" + file: "$(joinpath(DEFAULTS_DIR, "runtests.jl"))" project: false """ @test sprint(show, MIME("text/plain"), tpl(; authors=USER)) == rstrip(expected)