Skip to content

Commit

Permalink
fix tests (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pietro Vertechi authored Aug 28, 2018
1 parent 6a2eb95 commit 6296f48
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 5 deletions.
File renamed without changes.
83 changes: 83 additions & 0 deletions test/indexmd.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<textarea id="source">



# Example presentation


Some Julia code


```julia
1+2
```


--


A fragment


---




# Some equations


Here is a fraction: $\frac{1}{2}$


---




# A plot


```julia
using Plots; gr()
Plots.plot(rand(10))
savefig("statplot.svg");
```




# ![](statplot.svg)

</textarea>

<script src="remark.min.js" type="text/javascript"></script>
<script src="katex.min.js"></script>
<script src="auto-render.min.js"></script>
<link rel="stylesheet" href="katex.min.css">
<script type="text/javascript">
var options = {};
var renderMath = function() {
// renderMathInElement(document.body);
// or if you want to use $...$ for math,
renderMathInElement(document.body, {delimiters: [ // mind the order of delimiters(!?)
{left: "$$", right: "$$", display: true},
{left: "$", right: "$", display: false},
{left: "\\[", right: "\\]", display: true},
{left: "\\(", right: "\\)", display: false},
]});
}

var slideshow = remark.create({}, renderMath);

</script>
</body>
</html>
26 changes: 21 additions & 5 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Remark
using Test

demo = realpath(abspath(joinpath(@__DIR__, "..", "demo")))
demo = joinpath(@__DIR__, "..", "demo")
isdir(demo) && rm(demo, recursive = true)
sleep(1)

Expand All @@ -14,16 +14,32 @@ sleep(1)
@test all(isfile, Remark.depfiles)
end

isalnum(x) = isnumeric(x) || isletter(x)

@testset "slideshow" begin
slideshowdir = Remark.slideshow(joinpath(demo, "example.jl"))
@test slideshowdir == demo
@test slideshowdir == realpath(abspath(demo))
@test all(isdir, joinpath.(slideshowdir, "build", "fonts", ["Lora", "Ubuntu_Mono", "Yanone_Kaffeesatz"]))
for file in Remark.depfiles
@test isfile(joinpath(slideshowdir, "build", splitdir(file)[2]))
end
v1 = filter(isalnum, read(joinpath(@__DIR__, "indexjl.html"), String))
v2 = filter(isalnum, read(joinpath(demo, "build", "index.html"), String))
@test split(v1, "statplotsvg")[1] == split(v2, "statplotsvg")[1]
@test split(v1, "textarea")[3] == split(v2, "textarea")[3]
end

@testset "slideshowmd" begin
slideshowdir = Remark.slideshow(joinpath(demo, "example.md"))
@test slideshowdir == realpath(abspath(demo))
@test all(isdir, joinpath.(slideshowdir, "build", "fonts", ["Lora", "Ubuntu_Mono", "Yanone_Kaffeesatz"]))
for file in Remark.depfiles
@test isfile(joinpath(slideshowdir, "build", splitdir(file)[2]))
end
v1 = readlines(joinpath(@__DIR__, "index.html"))
v2 = readlines(joinpath(demo, "build", "index.html"))
@test all(v1 .== v2)
v1 = filter(isalnum, read(joinpath(@__DIR__, "indexmd.html"), String))
v2 = filter(isalnum, read(joinpath(demo, "build", "index.html"), String))
@test split(v1, "statplotsvg")[1] == split(v2, "statplotsvg")[1]
@test split(v1, "textarea")[3] == split(v2, "textarea")[3]
end

rm(demo, recursive = true)

0 comments on commit 6296f48

Please sign in to comment.