|
|
|
@ -154,17 +154,19 @@ content = """ |
|
|
|
""" |
|
|
|
""" |
|
|
|
|
|
|
|
|
|
|
|
@testset "Examples.markdown" begin |
|
|
|
@testset "Examples.markdown" begin |
|
|
|
withenv("TRAVIS_REPO_SLUG" => "fredrikekre/Examples.jl", |
|
|
|
|
|
|
|
"TRAVIS_TAG" => "v1.2.0", |
|
|
|
|
|
|
|
"HAS_JOSH_K_SEAL_OF_APPROVAL" => "true") do |
|
|
|
|
|
|
|
# test defaults |
|
|
|
|
|
|
|
mktempdir(@__DIR__) do sandbox |
|
|
|
mktempdir(@__DIR__) do sandbox |
|
|
|
cd(sandbox) do |
|
|
|
cd(sandbox) do |
|
|
|
# write content to inputfile |
|
|
|
# write content to inputfile |
|
|
|
inputfile = "inputfile.jl" |
|
|
|
inputfile = "inputfile.jl" |
|
|
|
write(inputfile, content) |
|
|
|
write(inputfile, content) |
|
|
|
outdir = mktempdir(pwd()) |
|
|
|
outdir = mktempdir(pwd()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# test defaults |
|
|
|
|
|
|
|
withenv("TRAVIS_REPO_SLUG" => "fredrikekre/Examples.jl", |
|
|
|
|
|
|
|
"TRAVIS_TAG" => "v1.2.0", |
|
|
|
|
|
|
|
"HAS_JOSH_K_SEAL_OF_APPROVAL" => "true") do |
|
|
|
Examples.markdown(inputfile, outdir) |
|
|
|
Examples.markdown(inputfile, outdir) |
|
|
|
|
|
|
|
end |
|
|
|
expected_markdown = """ |
|
|
|
expected_markdown = """ |
|
|
|
```@meta |
|
|
|
```@meta |
|
|
|
EditURL = "https://github.com/fredrikekre/Examples.jl/blob/master/test/$(basename(sandbox))/inputfile.jl" |
|
|
|
EditURL = "https://github.com/fredrikekre/Examples.jl/blob/master/test/$(basename(sandbox))/inputfile.jl" |
|
|
|
@ -209,15 +211,16 @@ content = """ |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
@test read(joinpath(outdir, "inputfile.md"), String) == expected_markdown |
|
|
|
@test read(joinpath(outdir, "inputfile.md"), String) == expected_markdown |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# no tag -> latest directory |
|
|
|
|
|
|
|
withenv("TRAVIS_REPO_SLUG" => "fredrikekre/Examples.jl", |
|
|
|
|
|
|
|
"TRAVIS_TAG" => "", |
|
|
|
|
|
|
|
"HAS_JOSH_K_SEAL_OF_APPROVAL" => "true") do |
|
|
|
|
|
|
|
Examples.markdown(inputfile, outdir) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
markdown = read(joinpath(outdir, "inputfile.md"), String) |
|
|
|
# test kwargs and pre- and post-processing |
|
|
|
@test contains(markdown, "fredrikekre/Examples.jl/blob/gh-pages/latest/") |
|
|
|
mktempdir(@__DIR__) do sandbox |
|
|
|
|
|
|
|
cd(sandbox) do |
|
|
|
|
|
|
|
# write content to inputfile |
|
|
|
|
|
|
|
inputfile = "inputfile.jl" |
|
|
|
|
|
|
|
write(inputfile, content) |
|
|
|
|
|
|
|
outdir = mktempdir(pwd()) |
|
|
|
|
|
|
|
# pre- and post-processing |
|
|
|
# pre- and post-processing |
|
|
|
Examples.markdown(inputfile, outdir, |
|
|
|
Examples.markdown(inputfile, outdir, |
|
|
|
preprocess = x -> replace(x, "Line 11" => "Foo"), |
|
|
|
preprocess = x -> replace(x, "Line 11" => "Foo"), |
|
|
|
@ -227,6 +230,7 @@ content = """ |
|
|
|
@test contains(markdown, "Foo") |
|
|
|
@test contains(markdown, "Foo") |
|
|
|
@test !contains(markdown, "Line 12") |
|
|
|
@test !contains(markdown, "Line 12") |
|
|
|
@test contains(markdown, "Bar") |
|
|
|
@test contains(markdown, "Bar") |
|
|
|
|
|
|
|
|
|
|
|
# documenter = false |
|
|
|
# documenter = false |
|
|
|
Examples.markdown(inputfile, outdir, documenter = false) |
|
|
|
Examples.markdown(inputfile, outdir, documenter = false) |
|
|
|
markdown = read(joinpath(outdir, "inputfile.md"), String) |
|
|
|
markdown = read(joinpath(outdir, "inputfile.md"), String) |
|
|
|
@ -234,12 +238,14 @@ content = """ |
|
|
|
@test !contains(markdown, "```@example") |
|
|
|
@test !contains(markdown, "```@example") |
|
|
|
@test !contains(markdown, "continued = true") |
|
|
|
@test !contains(markdown, "continued = true") |
|
|
|
@test !contains(markdown, "EditURL") |
|
|
|
@test !contains(markdown, "EditURL") |
|
|
|
|
|
|
|
|
|
|
|
# codefence |
|
|
|
# codefence |
|
|
|
Examples.markdown(inputfile, outdir, codefence = "```c" => "```") |
|
|
|
Examples.markdown(inputfile, outdir, codefence = "```c" => "```") |
|
|
|
markdown = read(joinpath(outdir, "inputfile.md"), String) |
|
|
|
markdown = read(joinpath(outdir, "inputfile.md"), String) |
|
|
|
@test contains(markdown, "```c") |
|
|
|
@test contains(markdown, "```c") |
|
|
|
@test !contains(markdown, "```@example") |
|
|
|
@test !contains(markdown, "```@example") |
|
|
|
@test !contains(markdown, "```julia") |
|
|
|
@test !contains(markdown, "```julia") |
|
|
|
|
|
|
|
|
|
|
|
# name |
|
|
|
# name |
|
|
|
Examples.markdown(inputfile, outdir, name = "foobar") |
|
|
|
Examples.markdown(inputfile, outdir, name = "foobar") |
|
|
|
markdown = read(joinpath(outdir, "foobar.md"), String) |
|
|
|
markdown = read(joinpath(outdir, "foobar.md"), String) |
|
|
|
@ -248,4 +254,3 @@ content = """ |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|