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
|
|
|
|
|
|
|
# TODO: add test for header processsing
|
|
|
|
# TODO: add test for `include_weave`
|
|
|
|
|
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
|
|
|
|
2018-07-25 20:43:38 +02:00
|
|
|
@testset "Weave" begin
|
2020-05-09 09:52:01 +02:00
|
|
|
@testset "module evaluation" begin
|
|
|
|
include("test_module_evaluation.jl")
|
|
|
|
end
|
|
|
|
|
|
|
|
@testset "header" begin
|
|
|
|
include("test_header.jl")
|
2018-07-25 23:12:48 +02:00
|
|
|
end
|
|
|
|
|
2020-05-24 13:52:53 +02:00
|
|
|
@testset "inline" begin
|
|
|
|
include("test_inline.jl")
|
|
|
|
end
|
|
|
|
|
2020-05-24 18:18:15 +02:00
|
|
|
@testset "chunk options" begin
|
|
|
|
include("test_chunk_options.jl")
|
|
|
|
end
|
|
|
|
|
2020-06-11 13:20:42 +02:00
|
|
|
@testset "evaluation's meta info" begin
|
|
|
|
include("test_meta.jl")
|
|
|
|
end
|
|
|
|
|
2020-05-09 15:35:45 +02:00
|
|
|
@testset "error rendering" begin
|
|
|
|
include("test_error_rendering.jl")
|
|
|
|
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
|
|
|
|
|
2018-07-25 20:43:38 +02:00
|
|
|
@testset "Formatters" begin
|
|
|
|
include("formatter_test.jl")
|
|
|
|
include("markdown_test.jl")
|
|
|
|
include("figureformatter_test.jl")
|
|
|
|
end
|
|
|
|
|
|
|
|
@testset "Rich output" begin
|
|
|
|
include("rich_output.jl")
|
|
|
|
end
|
2018-07-26 10:35:17 +02:00
|
|
|
|
2019-03-11 09:23:31 +01:00
|
|
|
@testset "Cache" begin
|
|
|
|
include("cache_test.jl")
|
|
|
|
end
|
|
|
|
|
2019-06-19 19:26:13 +02:00
|
|
|
# @testset "Notebooks" begin
|
|
|
|
# @info("Testing Jupyter options")
|
|
|
|
# include("notebooks.jl")
|
|
|
|
# end
|
2020-05-24 13:52:53 +02:00
|
|
|
|
2020-05-25 03:14:45 +02:00
|
|
|
# trigger only on CI
|
2020-05-25 04:46:54 +02:00
|
|
|
if get(ENV, "CI", nothing) == "true"
|
2020-05-25 03:14:45 +02:00
|
|
|
@testset "Plots" begin
|
|
|
|
include("plotsjl_test.jl")
|
|
|
|
end
|
2020-05-25 04:46:54 +02:00
|
|
|
|
2020-05-25 03:14:45 +02:00
|
|
|
@testset "Gadfly" begin
|
|
|
|
include("gadfly_formats.jl")
|
|
|
|
end
|
2020-05-25 04:46:54 +02:00
|
|
|
else
|
|
|
|
@info "skipped Plots.jl and Gadfly.jl integration test"
|
2020-05-25 03:14:45 +02:00
|
|
|
end
|
|
|
|
|
2020-05-24 13:52:53 +02:00
|
|
|
try
|
|
|
|
@testset "end2end (maybe fail)" begin
|
|
|
|
include("end2end.jl")
|
|
|
|
end
|
|
|
|
catch err
|
|
|
|
@error err
|
|
|
|
end
|
2019-03-06 21:27:47 +01:00
|
|
|
end
|