Weave.jl/test/cache_test.jl

34 lines
1.3 KiB
Julia
Raw Normal View History

2016-11-03 13:13:50 +01:00
using Weave
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)
2016-12-20 20:37:39 +01:00
result = readstring("documents/chunk_options.md")
2015-01-08 18:35:47 +01:00
rm("documents/chunk_options.md")
weave("documents/chunk_options.noweb", plotlib=nothing, cache=:all)
2016-12-20 20:37:39 +01:00
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);
2016-12-20 20:37:39 +01:00
result = readstring(out)
2015-01-08 18:35:47 +01:00
rm(out)
Weave.weave("documents/chunk_cache.noweb", plotlib=nothing, cache=:user);
2016-12-20 20:37:39 +01:00
cached_result = readstring(out)
@test result == cached_result
2015-01-09 13:17:56 +01:00
if VERSION.minor == 3
using Gadfly
isdir("documents/cache") && rm("documents/cache", recursive = true)
#Caching with Gadfly
weave("documents/gadfly_formats_test.txt", doctype="tex", plotlib="gadfly", cache=:all)
2016-12-20 20:37:39 +01:00
result = readstring("documents/gadfly_formats_test.tex")
2015-01-09 13:17:56 +01:00
rm("documents/gadfly_formats_test.tex")
weave("documents/gadfly_formats_test.txt", doctype="tex", plotlib="gadfly", cache=:all)
2016-12-20 20:37:39 +01:00
cached_result = readstring("documents/gadfly_formats_test.tex")
2015-01-09 13:17:56 +01:00
@test result == cached_result
end