Skip to content

Commit 9329ab7

Browse files
committed
add test
1 parent 5a9b1d7 commit 9329ab7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/misc.jl

+16
Original file line numberDiff line numberDiff line change
@@ -484,3 +484,19 @@ let
484484
@test c_18711 == 1
485485
end
486486

487+
let
488+
old_have_color = Base.have_color
489+
try
490+
eval(Base, :(have_color = true))
491+
buf = IOBuffer()
492+
print_with_color(:red, buf, "foo")
493+
# Check that we get back to normal text color in the end
494+
@test String(take!(buf)) == "\e[31mfoo\e[39m"
495+
496+
# Check that boldness is turned off
497+
print_with_color(:red, buf, "foo"; bold = true)
498+
@test String(take!(buf)) == "\e[1m\e[31mfoo\e[39m\e[22m"
499+
finally
500+
eval(Base, :(have_color = $(old_have_color)))
501+
end
502+
end

0 commit comments

Comments
 (0)