Skip to content

Commit b27de27

Browse files
committed
Add test for colorful output
1 parent e290463 commit b27de27

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

test/runtests.jl

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,4 +230,31 @@ end
230230
@test contains(str, "SUCCESS")
231231
end
232232

233+
# Issue <https://github.com/JuliaTesting/ParallelTestRunner.jl/issues/69>.
234+
@testset "Colorful output" begin
235+
testsuite = Dict(
236+
"color" => quote
237+
printstyled("Roses Are Red"; color=:red)
238+
end
239+
)
240+
io = IOBuffer()
241+
ioc = IOContext(io, :color=>true)
242+
runtests(ParallelTestRunner, String[]; testsuite, stdout=ioc, stderr=ioc)
243+
str = String(take!(io))
244+
@test contains(str, "\e[31mRoses Are Red\e[39m")
245+
@test contains(str, "SUCCESS")
246+
247+
testsuite = Dict(
248+
"no color" => quote
249+
printstyled("Violets are blue"; color=:blue)
250+
end
251+
)
252+
io = IOBuffer()
253+
runtests(ParallelTestRunner, String[]; testsuite, stdout=io, stderr=io)
254+
str = String(take!(io))
255+
@test contains(str, "Violets are blue")
256+
@test !contains(str, "\e[39m")
257+
@test contains(str, "SUCCESS")
258+
end
259+
233260
end

0 commit comments

Comments
 (0)