mirror of https://github.com/mpastell/Weave.jl
Fixed tests on Windows #65
parent
0234b3d059
commit
832b87d92a
|
@ -4,20 +4,20 @@ using Base.Test
|
|||
#Test if running document with and without cache works
|
||||
isdir("documents/cache") && rm("documents/cache", recursive = true)
|
||||
weave("documents/chunk_options.noweb", plotlib=nothing, cache=:all)
|
||||
result = readstring(open("documents/chunk_options.md"))
|
||||
result = readstring("documents/chunk_options.md")
|
||||
rm("documents/chunk_options.md")
|
||||
weave("documents/chunk_options.noweb", plotlib=nothing, cache=:all)
|
||||
cached_result = readstring(open("documents/chunk_options.md"))
|
||||
cached_result = readstring("documents/chunk_options.md")
|
||||
@test result == cached_result
|
||||
|
||||
# cache = :user
|
||||
isdir("documents/cache") && rm("documents/cache", recursive = true)
|
||||
out = "documents/chunk_cache.md"
|
||||
Weave.weave("documents/chunk_cache.noweb", plotlib=nothing, cache=:user);
|
||||
result = readstring(open(out))
|
||||
result = readstring(out)
|
||||
rm(out)
|
||||
Weave.weave("documents/chunk_cache.noweb", plotlib=nothing, cache=:user);
|
||||
cached_result = readstring(open(out))
|
||||
cached_result = readstring(out)
|
||||
@test result == cached_result
|
||||
|
||||
if VERSION.minor == 3
|
||||
|
@ -25,9 +25,9 @@ if VERSION.minor == 3
|
|||
isdir("documents/cache") && rm("documents/cache", recursive = true)
|
||||
#Caching with Gadfly
|
||||
weave("documents/gadfly_formats_test.txt", doctype="tex", plotlib="gadfly", cache=:all)
|
||||
result = readstring(open("documents/gadfly_formats_test.tex"))
|
||||
result = readstring("documents/gadfly_formats_test.tex")
|
||||
rm("documents/gadfly_formats_test.tex")
|
||||
weave("documents/gadfly_formats_test.txt", doctype="tex", plotlib="gadfly", cache=:all)
|
||||
cached_result = readstring(open("documents/gadfly_formats_test.tex"))
|
||||
cached_result = readstring("documents/gadfly_formats_test.tex")
|
||||
@test result == cached_result
|
||||
end
|
||||
|
|
|
@ -4,14 +4,14 @@ using Base.Test
|
|||
cleanup = true
|
||||
|
||||
weave("documents/chunk_options.noweb", plotlib=nothing)
|
||||
result = readstring(open("documents/chunk_options.md"))
|
||||
ref = readstring(open("documents/chunk_options_ref.md"))
|
||||
result = readstring("documents/chunk_options.md")
|
||||
ref = readstring("documents/chunk_options_ref.md")
|
||||
@test result == ref
|
||||
cleanup && rm("documents/chunk_options.md")
|
||||
|
||||
|
||||
tangle("documents/chunk_options.noweb", out_path = "documents/tangle")
|
||||
result = readstring(open("documents/tangle/chunk_options.jl"))
|
||||
ref = readstring(open("documents/tangle/chunk_options.jl.ref"))
|
||||
result = readstring("documents/tangle/chunk_options.jl")
|
||||
ref = readstring("documents/tangle/chunk_options.jl.ref")
|
||||
@test ref == result
|
||||
cleanup && rm("documents/tangle/chunk_options.jl")
|
||||
|
|
|
@ -5,14 +5,14 @@ cleanup = true
|
|||
|
||||
#Test hold and term options
|
||||
weave("documents/test_hold.mdw", doctype="pandoc", plotlib="Gadfly")
|
||||
result = readstring(open("documents/test_hold.md"))
|
||||
ref = readstring(open("documents/test_hold_ref.md"))
|
||||
result = readstring("documents/test_hold.md")
|
||||
ref = readstring("documents/test_hold_ref.md")
|
||||
@test result == ref
|
||||
cleanup && rm("documents/test_hold.md")
|
||||
|
||||
#Test setting and restoring chunk options
|
||||
Weave.weave("documents/default_opts.noweb", doctype = "tex")
|
||||
result = readstring(open("documents/default_opts.tex"))
|
||||
ref = readstring(open("documents/default_opts_ref.tex"))
|
||||
result = readstring("documents/default_opts.tex")
|
||||
ref = readstring("documents/default_opts_ref.tex")
|
||||
@test result == ref
|
||||
cleanup && rm("documents/default_opts.tex")
|
||||
|
|
|
@ -5,8 +5,8 @@ function convert_test(outfile)
|
|||
outfile = joinpath("documents/convert", outfile)
|
||||
infile = "documents/chunk_options.noweb"
|
||||
convert_doc(infile, outfile)
|
||||
result = readstring(open(outfile))
|
||||
ref = readstring(open(outfile * ".ref"))
|
||||
result = readstring(outfile)
|
||||
ref = readstring(outfile * ".ref")
|
||||
@test result == ref
|
||||
rm(outfile)
|
||||
end
|
||||
|
@ -20,8 +20,8 @@ function convert_test_nb(outfile)
|
|||
outfile = joinpath("documents/convert", outfile)
|
||||
infile = "documents/chunk_options.ipynb"
|
||||
convert_doc(infile, outfile)
|
||||
result = readstring(open(outfile))
|
||||
ref = readstring(open(outfile * ".ref"))
|
||||
result = readstring(outfile)
|
||||
ref = readstring(outfile * ".ref")
|
||||
rm(outfile)
|
||||
@test result == ref
|
||||
end
|
||||
|
|
|
@ -4,57 +4,57 @@ using Base.Test
|
|||
|
||||
|
||||
weave("documents/gadfly_formats_test.txt", "tex")
|
||||
result = readstring(open("documents/gadfly_formats_test.tex"))
|
||||
ref = readstring(open("documents/gadfly_formats_test_ref.tex"))
|
||||
result = readstring("documents/gadfly_formats_test.tex")
|
||||
ref = readstring("documents/gadfly_formats_test_ref.tex")
|
||||
@test result == ref
|
||||
|
||||
weave("documents/gadfly_formats_test.txt", doctype="tex", fig_ext=".tex", plotlib="gadfly")
|
||||
result = readstring(open("documents/gadfly_formats_test.tex"))
|
||||
ref = readstring(open("documents/gadfly_formats_test_tikz_ref.tex"))
|
||||
result = readstring("documents/gadfly_formats_test.tex")
|
||||
ref = readstring("documents/gadfly_formats_test_tikz_ref.tex")
|
||||
@test result == ref
|
||||
|
||||
weave("documents/gadfly_formats_test.txt", doctype="tex", fig_ext=".ps", plotlib="gadfly")
|
||||
result = readstring(open("documents/gadfly_formats_test.tex"))
|
||||
ref = readstring(open("documents/gadfly_formats_test_ps_ref.tex"))
|
||||
result = readstring("documents/gadfly_formats_test.tex")
|
||||
ref = readstring("documents/gadfly_formats_test_ps_ref.tex")
|
||||
@test result == ref
|
||||
|
||||
weave("documents/gadfly_formats_test.txt", doctype="pandoc", plotlib="gadfly")
|
||||
result = readstring(open("documents/gadfly_formats_test.md"))
|
||||
ref = readstring(open("documents/gadfly_formats_test_pandoc_ref.md"))
|
||||
result = readstring("documents/gadfly_formats_test.md")
|
||||
ref = readstring("documents/gadfly_formats_test_pandoc_ref.md")
|
||||
@test result == ref
|
||||
|
||||
weave("documents/gadfly_formats_test.txt", doctype="pandoc", plotlib="gadfly", fig_ext=".svg")
|
||||
result = readstring(open("documents/gadfly_formats_test.md"))
|
||||
ref = readstring(open("documents/gadfly_formats_test_svg_ref.md"))
|
||||
result = readstring("documents/gadfly_formats_test.md")
|
||||
ref = readstring("documents/gadfly_formats_test_svg_ref.md")
|
||||
@test result == ref
|
||||
|
||||
weave("documents/gadfly_formats_test.txt", doctype="github", plotlib="gadfly", fig_ext=".js.svg")
|
||||
result = readstring(open("documents/gadfly_formats_test.md"))
|
||||
ref = readstring(open("documents/gadfly_formats_test_jssvg_ref.md"))
|
||||
result = readstring("documents/gadfly_formats_test.md")
|
||||
ref = readstring("documents/gadfly_formats_test_jssvg_ref.md")
|
||||
@test result == ref
|
||||
|
||||
weave("documents/gadfly_formats_test.txt", doctype="rst", plotlib="gadfly")
|
||||
result = readstring(open("documents/gadfly_formats_test.rst"))
|
||||
ref = readstring(open("documents/gadfly_formats_test_ref.rst"))
|
||||
result = readstring("documents/gadfly_formats_test.rst")
|
||||
ref = readstring("documents/gadfly_formats_test_ref.rst")
|
||||
@test result == ref
|
||||
|
||||
weave("documents/gadfly_formats_test.txt", doctype="multimarkdown", plotlib="gadfly")
|
||||
result = readstring(open("documents/gadfly_formats_test.md"))
|
||||
ref = readstring(open("documents/gadfly_formats_test_mmd_ref.md"))
|
||||
result = readstring("documents/gadfly_formats_test.md")
|
||||
ref = readstring("documents/gadfly_formats_test_mmd_ref.md")
|
||||
@test result == ref
|
||||
|
||||
weave("documents/gadfly_formats_test.txt", doctype="asciidoc", plotlib="gadfly",
|
||||
out_path="documents/output")
|
||||
result = readstring(open("documents/output/gadfly_formats_test.txt"))
|
||||
ref = readstring(open("documents/output/gadfly_formats_test_ref.txt"))
|
||||
result = readstring("documents/output/gadfly_formats_test.txt")
|
||||
ref = readstring("documents/output/gadfly_formats_test_ref.txt")
|
||||
@test result == ref
|
||||
|
||||
weave("documents/gadfly_markdown_test.jmd", doctype="github",plotlib="gadfly", informat="markdown")
|
||||
result = readstring(open("documents/gadfly_markdown_test.md"))
|
||||
ref = readstring(open("documents/gadfly_markdown_test_ref.md"))
|
||||
result = readstring("documents/gadfly_markdown_test.md")
|
||||
ref = readstring("documents/gadfly_markdown_test_ref.md")
|
||||
@test result == ref
|
||||
|
||||
weave("documents/FIR_design.jl", doctype="pandoc", plotlib="gadfly", informat="script")
|
||||
result = readstring(open("documents/FIR_design.md"))
|
||||
ref = readstring(open("documents/FIR_design_ref.md"))
|
||||
result = readstring("documents/FIR_design.md")
|
||||
ref = readstring("documents/FIR_design_ref.md")
|
||||
@test result == ref
|
||||
|
|
|
@ -3,8 +3,8 @@ using Base.Test
|
|||
|
||||
function pljtest(source, resfile, doctype)
|
||||
weave("documents/$source", out_path = "documents/plotsjl/$resfile", doctype=doctype)
|
||||
result = readstring(open("documents/plotsjl/$resfile"))
|
||||
ref = readstring(open("documents/plotsjl/$resfile.ref"))
|
||||
result = readstring("documents/plotsjl/$resfile")
|
||||
ref = readstring("documents/plotsjl/$resfile.ref")
|
||||
@test result == ref
|
||||
rm("documents/plotsjl/$resfile")
|
||||
end
|
||||
|
|
|
@ -5,12 +5,12 @@ function publish_test(outfile, format)
|
|||
outfile = joinpath("documents/publish", outfile)
|
||||
infile = "documents/publish_test.jmd"
|
||||
weave(infile, doctype = format, out_path = outfile, template = "templates/mini.tpl")
|
||||
result = readstring(open(outfile))
|
||||
ref = readstring(open(outfile * ".ref"))
|
||||
result = readstring(outfile)
|
||||
ref = readstring(outfile * ".ref")
|
||||
@test result == ref
|
||||
rm(outfile)
|
||||
end
|
||||
|
||||
#Test formatters
|
||||
publish_test("publish_tex.tex", "md2tex")
|
||||
publish_test("publish_test.html", "md2html")
|
||||
!is_windows() && publish_test("publish_test.html", "md2html")
|
||||
|
|
|
@ -4,23 +4,23 @@ using Base.Test
|
|||
cleanup = true
|
||||
|
||||
weave("documents/pyplot_formats.txt", plotlib="pyplot", doctype="tex")
|
||||
result = readstring(open("documents/pyplot_formats.tex"))
|
||||
ref = readstring(open("documents/pyplot_formats_ref.tex"))
|
||||
result = readstring("documents/pyplot_formats.tex")
|
||||
ref = readstring("documents/pyplot_formats_ref.tex")
|
||||
result = replace(result, r"\s*PyObject.*\n", "\n") #Remove PyObjects, because they change
|
||||
ref = replace(ref, r"\s*PyObject.*\n", "\n")
|
||||
@test result == ref
|
||||
|
||||
weave("documents/pyplot_formats.txt", plotlib="pyplot", doctype="github")
|
||||
result = readstring(open("documents/pyplot_formats.md"))
|
||||
ref = readstring(open("documents/pyplot_formats_ref.md"))
|
||||
result = readstring("documents/pyplot_formats.md")
|
||||
ref = readstring("documents/pyplot_formats_ref.md")
|
||||
result = replace(result, r"\s*PyObject.*\n", "")
|
||||
ref = replace(ref, r"\s*PyObject.*\n", "")
|
||||
@test result == ref
|
||||
|
||||
|
||||
weave("documents/pyplot_formats.txt", plotlib="pyplot", doctype="rst", fig_ext=".svg")
|
||||
result = readstring(open("documents/pyplot_formats.rst"))
|
||||
ref = readstring(open("documents/pyplot_formats_ref.rst"))
|
||||
result = readstring("documents/pyplot_formats.rst")
|
||||
ref = readstring("documents/pyplot_formats_ref.rst")
|
||||
result = replace(result, r"\s*PyObject.*\n", "")
|
||||
ref = replace(ref, r"\s*PyObject.*\n", "")
|
||||
@test result == ref
|
||||
|
|
Loading…
Reference in New Issue