Skip to content

Commit

Permalink
fix nightly test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnychen94 committed Aug 1, 2020
1 parent 2689c14 commit b4347cc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/render.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,17 @@ end
mode = BeforeAfterFull()
for (x, xname) in items
# @info "Types" x=typeof(x) mode=mode
@test_reference joinpath(refdir, "BeforeAfterFull", "$(xname)_new.txt") @io2str render(::IO, mode, x[2])
@test_reference joinpath(refdir, "BeforeAfterFull", "$(xname)_compare.txt") @io2str render(::IO, mode, x...)
@test_reference joinpath(refdir, "BeforeAfterFull", "$(xname)_new.txt") @io2str(render(::IO, mode, x[2])) by=string_check
@test_reference joinpath(refdir, "BeforeAfterFull", "$(xname)_compare.txt") @io2str(render(::IO, mode, x...)) by=string_check
end
end

@testset "BeforeAfterLimited" begin
mode = BeforeAfterLimited()
for (x, xname) in items
# @info "Types" x=typeof(x) mode=mode
@test_reference joinpath(refdir, "BeforeAfterLimited", "$(xname)_new.txt") @io2str render(::IO, mode, x[2])
@test_reference joinpath(refdir, "BeforeAfterLimited", "$(xname)_compare.txt") @io2str render(::IO, mode, x...)
@test_reference joinpath(refdir, "BeforeAfterLimited", "$(xname)_new.txt") @io2str(render(::IO, mode, x[2])) by=string_check
@test_reference joinpath(refdir, "BeforeAfterLimited", "$(xname)_compare.txt") @io2str(render(::IO, mode, x...)) by=string_check
end
end

Expand All @@ -102,8 +102,8 @@ end
(str3, "str3"),
)
# @info "Types" x=typeof(x) mode=mode
@test_reference joinpath(refdir, "Diff", "$(xname)_new.txt") @io2str render(::IO, mode, x[2])
@test_reference joinpath(refdir, "Diff", "$(xname)_compare.txt") @io2str render(::IO, mode, x...)
@test_reference joinpath(refdir, "Diff", "$(xname)_new.txt") @io2str(render(::IO, mode, x[2])) by=string_check
@test_reference joinpath(refdir, "Diff", "$(xname)_compare.txt") @io2str(render(::IO, mode, x...)) by=string_check
end
end

Expand All @@ -117,8 +117,8 @@ end
# (img3d_1, "img3d_1")
)
# @info "Types" x=typeof(x) mode=mode
@test_reference joinpath(refdir, "BeforeAfterImage", "$(xname)_new.txt") @io2str render(::IO, mode, x[2])
@test_reference joinpath(refdir, "BeforeAfterImage", "$(xname)_compare.txt") @io2str render(::IO, mode, x...)
@test_reference joinpath(refdir, "BeforeAfterImage", "$(xname)_new.txt") @io2str(render(::IO, mode, x[2])) by=string_check
@test_reference joinpath(refdir, "BeforeAfterImage", "$(xname)_compare.txt") @io2str(render(::IO, mode, x...)) by=string_check
end
end

Expand Down
20 changes: 20 additions & 0 deletions test/testutils.jl
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
strip_summary(content::String) = join(split(content, "\n")[2:end], "\n")

function string_check(ref, actual)
# a over-verbose collection of patterns that we want to ignore during test
patterns = [
# Julia v1.6
"Normed{UInt8,8}" => "N0f8",
r"Array{(\w+),2}" => s"Matrix{\1}",
r"Array{(\w+),1}" => s"Vector{\1}",

# https://github.com/JuliaGraphics/ColorTypes.jl/pull/206
# r"Gray{\w+}\(([\w\.]+)\)" => s"\1",
# r"RGB{\w+}\(([\w\.,]+)\)" => s"RGB(\1)",
]

for p in patterns
actual = replace(actual, p)
ref = replace(ref, p)
end
isequal(ref, actual)
end

0 comments on commit b4347cc

Please sign in to comment.