Skip to content

Commit 0f57ce8

Browse files
committed
Test custom CSS
1 parent 44eb65d commit 0f57ce8

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Dates = "1.6"
2323
DefaultApplication = "1"
2424
DocStringExtensions = "0.8, 0.9"
2525
EzXML = "1"
26+
FileCmp = "1"
2627
LibGit2 = "1.6"
2728
OrderedCollections = "1"
2829
Pkg = "1.6"
@@ -32,6 +33,7 @@ julia = "1.6"
3233

3334
[extras]
3435
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
36+
FileCmp = "343a5541-a696-4ae7-8102-bc61c09e1896"
3537

3638
[targets]
37-
test = ["Test"]
39+
test = ["Test","FileCmp"]

test/dummy.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
body {
2+
color: white;
3+
background-color: black;
4+
}

test/runtests.jl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
using LocalCoverage, Test
2+
using FileCmp
3+
24
import Pkg
35

46
Pkg.activate("./DummyPackage/")
@@ -15,7 +17,8 @@ function test_coverage(pkg;
1517
run_test = true,
1618
test_args = [""],
1719
folder_list = ["src"],
18-
file_list = [])
20+
file_list = [],
21+
css = nothing)
1922
@info "Testing coverage for $pkg" test_args folder_list file_list
2023
clean_coverage(pkg)
2124
@test isdir(LocalCoverage.pkgdir(pkg))
@@ -47,8 +50,10 @@ function test_coverage(pkg;
4750

4851
if !isnothing(Sys.which("genhtml"))
4952
mktempdir() do dir
50-
html_coverage(pkg, dir = dir)
53+
html_coverage(pkg, dir = dir, css = css)
5154
@test isfile(joinpath(dir, "index.html"))
55+
isnothing(css) ||
56+
@test filecmp(joinpath(dir, "gcov.css"), css)
5257
end
5358
end
5459

@@ -83,6 +88,11 @@ end
8388
folder_list = [joinpath(dirname(@__FILE__), "DummyPackage", "src", "corge")],
8489
file_list = [joinpath(dirname(@__FILE__), "DummyPackage", "src", "qux.jl")])
8590
end
91+
92+
@testset "custom CSS" begin
93+
@test_throws TypeError test_coverage("DummyPackage", css=1)
94+
test_coverage("DummyPackage", css=joinpath(dirname(@__FILE__), "dummy.css"))
95+
end
8696
end
8797

8898
@test LocalCoverage.find_gaps([nothing, 0, 0, 0, 2, 3, 0, nothing, 0, 3, 0, 6, 2]) ==

0 commit comments

Comments
 (0)