@@ -395,6 +395,7 @@ function retest(args::Union{Module,AbstractString,Regex}...;
395
395
end
396
396
397
397
gotprinted = false
398
+ align_overflow = 0
398
399
399
400
previewer = previewchan === nothing ? nothing :
400
401
@async begin
@@ -418,6 +419,7 @@ function retest(args::Union{Module,AbstractString,Regex}...;
418
419
elseif gotprinted
419
420
desc = " "
420
421
gotprinted = false
422
+ align_overflow = 0
421
423
elseif desc != " "
422
424
align = format. desc_align
423
425
if nworkers () > 1
@@ -434,7 +436,20 @@ function retest(args::Union{Module,AbstractString,Regex}...;
434
436
description = " " * description
435
437
end
436
438
cursor += 1
437
- printstyled (' \r ' , rpad (" $description " , align, " " ), ' ' ,
439
+
440
+ # when verbose == 0, we still can print the currently run
441
+ # testset, but then its description might be larger than
442
+ # `align`, because it was not taken into account for computing
443
+ # `align`;
444
+ # `align_overflow` computes how many characters do overflow,
445
+ # so that the printer can "erase" them later on;
446
+ # once we overflow, we don't go back (leftwards) until the
447
+ # printer prints
448
+ align_overflow =
449
+ max (align_overflow, textwidth (description) - align)
450
+ printstyled (' \r ' ,
451
+ rpad (" $description " , align+ align_overflow, " " ),
452
+ ' ' ,
438
453
timer[mod1 (cursor, end )];
439
454
style... )
440
455
end
@@ -453,12 +468,22 @@ function retest(args::Union{Module,AbstractString,Regex}...;
453
468
if many || verbose == 0
454
469
@assert endswith (module_ts. description, ' :' )
455
470
module_ts. description = chop (module_ts. description, tail= 1 )
471
+ clear_line ()
456
472
Testset. print_test_results (module_ts, format,
457
473
bold= true , hasbroken= hasbroken)
458
474
else
459
475
nothing
460
476
end
461
477
478
+ # if the previewer overflowed, we must clear the line, otherwise, if
479
+ # what we print now isn't as large, leftovers from the previewer
480
+ # will be seen
481
+ clear_line () = if previewchan != = nothing
482
+ # +2: for the final space before spinning wheel and the wheel
483
+ print (' \r ' * ' ' ^ (format. desc_align+ align_overflow+ 2 ) * ' \r ' )
484
+ align_overflow = 0
485
+ end
486
+
462
487
while ! finito
463
488
rts = take! (outchan)
464
489
lock (printlock) do
@@ -470,8 +495,6 @@ function retest(args::Union{Module,AbstractString,Regex}...;
470
495
end
471
496
end
472
497
gotprinted = true
473
- previewchan === nothing ||
474
- print (' \r ' )
475
498
476
499
if rts === nothing
477
500
errored || print_overall ()
@@ -481,6 +504,7 @@ function retest(args::Union{Module,AbstractString,Regex}...;
481
504
errored && return
482
505
483
506
if verbose > 0 || rts. anynonpass
507
+ clear_line ()
484
508
Testset. print_test_results (
485
509
rts, format;
486
510
depth = Int (! rts. overall & isindented (verbose, overall, many)),
0 commit comments