Skip to content

Commit 1f6a43f

Browse files
committed
Trial run of using testsets for Base
1 parent c775fc5 commit 1f6a43f

File tree

5 files changed

+854
-779
lines changed

5 files changed

+854
-779
lines changed

base/test.jl

+18-15
Original file line numberDiff line numberDiff line change
@@ -439,17 +439,7 @@ end
439439
# the results at the end of the tests
440440
record(ts::DefaultTestSet, t::AbstractTestSet) = push!(ts.results, t)
441441

442-
# Called at the end of a @testset, behaviour depends on whether
443-
# this is a child of another testset, or the "root" testset
444-
function finish(ts::DefaultTestSet)
445-
# If we are a nested test set, do not print a full summary
446-
# now - let the parent test set do the printing
447-
if get_testset_depth() != 0
448-
# Attach this test set to the parent test set
449-
parent_ts = get_testset()
450-
record(parent_ts, ts)
451-
return
452-
end
442+
function print_test_results(ts::DefaultTestSet, depth_pad=0)
453443
# Calculate the overall number for each type so each of
454444
# the test result types are aligned
455445
passes, fails, errors, broken, c_passes, c_fails, c_errors, c_broken = get_test_counts(ts)
@@ -492,11 +482,25 @@ function finish(ts::DefaultTestSet)
492482
end
493483
println()
494484
# Recursively print a summary at every level
495-
print_counts(ts, 0, align, pass_width, fail_width, error_width, broken_width, total_width)
485+
print_counts(ts, depth_pad, align, pass_width, fail_width, error_width, broken_width, total_width)
486+
end
487+
488+
# Called at the end of a @testset, behaviour depends on whether
489+
# this is a child of another testset, or the "root" testset
490+
function finish(ts::DefaultTestSet)
491+
# If we are a nested test set, do not print a full summary
492+
# now - let the parent test set do the printing
493+
if get_testset_depth() != 0
494+
# Attach this test set to the parent test set
495+
parent_ts = get_testset()
496+
record(parent_ts, ts)
497+
return
498+
end
496499
# Finally throw an error as we are the outermost test set
497-
if total != total_pass
500+
#print_test_results(ts)
501+
#=if total != total_pass
498502
throw(TestSetException(total_pass,total_fail,total_error, total_broken))
499-
end
503+
end=#
500504

501505
# return the testset so it is returned from the @testset macro
502506
ts
@@ -550,7 +554,6 @@ function print_counts(ts::DefaultTestSet, depth, align,
550554
# through and child test sets
551555
passes, fails, errors, broken, c_passes, c_fails, c_errors, c_broken = get_test_counts(ts)
552556
subtotal = passes + fails + errors + broken + c_passes + c_fails + c_errors + c_broken
553-
554557
# Print test set header, with an alignment that ensures all
555558
# the test results appear above each other
556559
print(rpad(string(lpad(" ",depth), ts.description), align, " "), " | ")

0 commit comments

Comments
 (0)