Skip to content

Commit 6d6265b

Browse files
committed
hook up test macro to ENV color settings
1 parent c247d3f commit 6d6265b

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

base/test.jl

+11-11
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ type Fail <: Result
7070
value
7171
end
7272
function Base.show(io::IO, t::Fail)
73-
print_with_color(:light_red, io, "Test Failed\n"; bold = true)
73+
print_with_color(Base.error_color(), io, "Test Failed\n"; bold = true)
7474
print(io, " Expression: ", t.orig_expr)
7575
if t.test_type == :test_throws_wrong
7676
# An exception was thrown, but it was of the wrong type
@@ -102,7 +102,7 @@ type Error <: Result
102102
backtrace
103103
end
104104
function Base.show(io::IO, t::Error)
105-
print_with_color(:light_red, io, "Error During Test\n"; bold = true)
105+
print_with_color(Base.error_color(), io, "Error During Test\n"; bold = true)
106106
if t.test_type == :test_nonbool
107107
println(io, " Expression evaluated to non-Boolean")
108108
println(io, " Expression: ", t.orig_expr)
@@ -483,16 +483,16 @@ function print_test_results(ts::DefaultTestSet, depth_pad=0)
483483
print_with_color(:green, lpad("Pass",pass_width," "), " "; bold = true)
484484
end
485485
if fail_width > 0
486-
print_with_color(:light_red, lpad("Fail",fail_width," "), " "; bold = true)
486+
print_with_color(Base.error_color(), lpad("Fail",fail_width," "), " "; bold = true)
487487
end
488488
if error_width > 0
489-
print_with_color(:light_red, lpad("Error",error_width," "), " "; bold = true)
489+
print_with_color(Base.error_color(), lpad("Error",error_width," "), " "; bold = true)
490490
end
491491
if broken_width > 0
492492
print_with_color(:yellow, lpad("Broken",broken_width," "), " "; bold = true)
493493
end
494494
if total_width > 0
495-
print_with_color(:blue, lpad("Total",total_width, " "); bold = true)
495+
print_with_color(Base.info_color(), lpad("Total",total_width, " "); bold = true)
496496
end
497497
println()
498498
# Recursively print a summary at every level
@@ -595,40 +595,40 @@ function print_counts(ts::DefaultTestSet, depth, align,
595595

596596
np = passes + c_passes
597597
if np > 0
598-
print_with_color(:green, lpad(string(np), pass_width, " "), " "; bold = true)
598+
print_with_color(:green, lpad(string(np), pass_width, " "), " ")
599599
elseif pass_width > 0
600600
# No passes at this level, but some at another level
601601
print(lpad(" ", pass_width), " ")
602602
end
603603

604604
nf = fails + c_fails
605605
if nf > 0
606-
print_with_color(:light_red, lpad(string(nf), fail_width, " "), " "; bold = true)
606+
print_with_color(Base.error_color(), lpad(string(nf), fail_width, " "), " ")
607607
elseif fail_width > 0
608608
# No fails at this level, but some at another level
609609
print(lpad(" ", fail_width), " ")
610610
end
611611

612612
ne = errors + c_errors
613613
if ne > 0
614-
print_with_color(:light_red, lpad(string(ne), error_width, " "), " "; bold = true)
614+
print_with_color(Base.error_color(), lpad(string(ne), error_width, " "), " ")
615615
elseif error_width > 0
616616
# No errors at this level, but some at another level
617617
print(lpad(" ", error_width), " ")
618618
end
619619

620620
nb = broken + c_broken
621621
if nb > 0
622-
print_with_color(:yellow, lpad(string(nb), broken_width, " "), " "; bold = true)
622+
print_with_color(:yellow, lpad(string(nb), broken_width, " "), " ")
623623
elseif broken_width > 0
624624
# None broken at this level, but some at another level
625625
print(lpad(" ", broken_width), " ")
626626
end
627627

628628
if np == 0 && nf == 0 && ne == 0 && nb == 0
629-
print_with_color(:blue, "No tests"; bold = true)
629+
print_with_color(Base.info_color(), "No tests")
630630
else
631-
print_with_color(:blue, lpad(string(subtotal), total_width, " "); bold = true)
631+
print_with_color(Base.info_color(), lpad(string(subtotal), total_width, " "))
632632
end
633633
println()
634634

0 commit comments

Comments
 (0)