forked from JunoLab/Weave.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_simple.jl
47 lines (38 loc) · 911 Bytes
/
test_simple.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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", "minted2pdf")
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