2020-06-13 18:43:32 +02:00
|
|
|
# TODO:
|
|
|
|
# - reorganize this
|
|
|
|
# - test for `include_weave`
|
|
|
|
# - fire horrible tests
|
|
|
|
# - test for ipynb integration
|
2020-06-13 19:24:25 +02:00
|
|
|
# - test for integrations with other libraries, especially for Plots.jl and Gadfly.jl
|
2020-06-13 18:43:32 +02:00
|
|
|
|
|
|
|
# %%
|
2020-05-15 17:38:18 +02:00
|
|
|
using Weave, Test
|
2020-05-15 18:49:55 +02:00
|
|
|
using Weave: WeaveDoc, run_doc
|
2014-12-06 18:16:45 +01:00
|
|
|
|
2020-05-09 09:52:01 +02:00
|
|
|
|
2020-06-05 11:59:02 +02:00
|
|
|
function mock_doc(str, informat = "markdown")
|
2020-05-15 16:51:52 +02:00
|
|
|
f = tempname()
|
|
|
|
write(f, str)
|
2020-06-05 11:59:02 +02:00
|
|
|
return WeaveDoc(f, informat)
|
|
|
|
end
|
|
|
|
mock_run(str, informat = "markdown"; kwargs...) = run_doc(mock_doc(str, informat); kwargs...)
|
|
|
|
|
|
|
|
function test_mock_weave(test_function, str; kwargs...)
|
|
|
|
f = tempname()
|
|
|
|
write(f, str)
|
|
|
|
f = weave(f; kwargs...)
|
|
|
|
try
|
|
|
|
weave_body = read(f, String)
|
|
|
|
test_function(weave_body)
|
|
|
|
catch
|
|
|
|
rethrow()
|
|
|
|
finally
|
|
|
|
rm(f)
|
|
|
|
end
|
2020-05-15 16:51:52 +02:00
|
|
|
end
|
2020-05-09 15:33:58 +02:00
|
|
|
|
2020-05-09 09:52:01 +02:00
|
|
|
|
2020-06-13 18:43:32 +02:00
|
|
|
# %%
|
2018-07-25 20:43:38 +02:00
|
|
|
@testset "Weave" begin
|
2020-06-13 18:43:32 +02:00
|
|
|
@testset "reader" begin
|
|
|
|
include("reader/test_chunk_options.jl")
|
|
|
|
include("reader/test_inline.jl")
|
2020-05-09 09:52:01 +02:00
|
|
|
end
|
|
|
|
|
2020-06-13 18:43:32 +02:00
|
|
|
@testset "header processing" begin
|
2020-05-09 09:52:01 +02:00
|
|
|
include("test_header.jl")
|
2018-07-25 23:12:48 +02:00
|
|
|
end
|
|
|
|
|
2020-06-13 18:43:32 +02:00
|
|
|
@testset "run" begin
|
|
|
|
include("run/test_module.jl")
|
|
|
|
include("run/test_meta.jl")
|
|
|
|
include("run/test_error.jl")
|
2020-05-09 15:35:45 +02:00
|
|
|
end
|
|
|
|
|
2020-05-16 14:33:01 +02:00
|
|
|
@testset "conversions" begin
|
2020-05-15 17:38:18 +02:00
|
|
|
include("test_converter.jl")
|
2018-07-25 20:43:38 +02:00
|
|
|
end
|
|
|
|
|
2020-05-16 16:25:44 +02:00
|
|
|
@testset "display" begin
|
|
|
|
include("test_display.jl")
|
|
|
|
end
|
|
|
|
|
2020-06-13 19:24:25 +02:00
|
|
|
@testset "legacy" begin
|
2018-07-25 20:43:38 +02:00
|
|
|
include("formatter_test.jl")
|
|
|
|
include("markdown_test.jl")
|
|
|
|
include("figureformatter_test.jl")
|
2019-03-11 09:23:31 +01:00
|
|
|
include("cache_test.jl")
|
|
|
|
end
|
2019-03-06 21:27:47 +01:00
|
|
|
end
|