From 6296f48854ab54f47ccd8ca7dc9866090bb1e767 Mon Sep 17 00:00:00 2001 From: Pietro Vertechi Date: Tue, 28 Aug 2018 19:36:31 +0100 Subject: [PATCH] fix tests (#14) --- test/{index.html => indexjl.html} | 0 test/indexmd.html | 83 +++++++++++++++++++++++++++++++ test/runtests.jl | 26 ++++++++-- 3 files changed, 104 insertions(+), 5 deletions(-) rename test/{index.html => indexjl.html} (100%) create mode 100644 test/indexmd.html diff --git a/test/index.html b/test/indexjl.html similarity index 100% rename from test/index.html rename to test/indexjl.html diff --git a/test/indexmd.html b/test/indexmd.html new file mode 100644 index 0000000..e13f120 --- /dev/null +++ b/test/indexmd.html @@ -0,0 +1,83 @@ + + + + Title + + + + + + + + + + + + + diff --git a/test/runtests.jl b/test/runtests.jl index 7cf1e91..82f7f08 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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) @@ -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)