add simple end2end test

pull/377/head
Shuhei Kadowaki 2020-06-14 21:21:45 +09:00
parent 2a509d8f96
commit 5f0d9d4627
3 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,11 @@
# NOTE:
# This test file does end to end tests, while we don't want to check the details in the generated documents.
# Rather, we just assert we can `weave` all the supported formats without errors here.
# TODO:
# - more complex example
# - integration with other libraries, like Plots
@testset "end2end simple" begin
include("test_simple.jl")
end # @testset "end2end"

View File

@ -0,0 +1,48 @@
using Weave.Dates
test_doctypes = filter(first.(Weave.list_out_formats())) do doctype
# don't test doctypes which need external programs
doctype ("pandoc2html", "pandoc2pdf", "md2pdf")
end
function test_func(body)
@test !isempty(body)
date_str = string(Date(now()))
@test occursin(date_str, body)
end
# julia markdown
julia_markdown_body = """
# doc chunk
this is text with `j :inline` code
code chunk:
```julia
using Dates
Date(now())
```
"""
for doctype in test_doctypes
test_mock_weave(test_func, julia_markdown_body; informat = "markdown", doctype = doctype)
end
# TODO: test noweb format
# julia script
julia_script_body = """
#' # doc chunk
#'
#' this is text with `j :inline` code
#'
#' code chunk:
#+
using Dates
Date(now())
"""
for doctype in test_doctypes
test_mock_weave(test_func, julia_script_body; informat = "script", doctype = doctype)
end

View File

@ -61,6 +61,10 @@ end
include("test_display.jl")
end
@testset "end2end" begin
include("end2end/test_end2end.jl")
end
@testset "legacy" begin
include("markdown_test.jl")
include("render_figures_test.jl")