@@ -47,7 +47,7 @@ include("hijack.jl")
47
47
include (" watch.jl" )
48
48
include (" patterns.jl" )
49
49
50
- using . Testset: Testset, Format
50
+ using . Testset: Testset, Format, print_id
51
51
52
52
53
53
# * TestsetExpr
@@ -723,7 +723,7 @@ function retest(@nospecialize(args::ArgType...);
723
723
printlock = ReentrantLock ()
724
724
previewchan =
725
725
if stdout isa Base. TTY && (nthreads () > 1 && VERSION >= v " 1.3" || nprocs () > 1 )
726
- RemoteChannel (() -> Channel {Maybe{String}} (Inf ))
726
+ RemoteChannel (() -> Channel {Maybe{Tuple{Int64, String} }} (Inf ))
727
727
# needs to be "remote" in the case nprocs() == 2, as then nworkers() == 1,
728
728
# which means the one remote worker will put descriptions on previewchan
729
729
# (if nworkers() > 1, descriptions are not put because we can't predict
@@ -749,29 +749,35 @@ function retest(@nospecialize(args::ArgType...);
749
749
align_overflow = 0
750
750
751
751
function take_latest! (previewchan)
752
- local desc
752
+ local id_desc
753
753
while isready (previewchan)
754
754
# printer/previewer can't take! it, as we locked
755
- desc = take! (previewchan)
755
+ id_desc = take! (previewchan)
756
+ end
757
+ if @isdefined (id_desc)
758
+ something (id_desc, (Int64 (0 ), nothing ))
759
+ else
760
+ (Int64 (0 ), " " )
756
761
end
757
- @isdefined (desc) ? desc : " "
758
762
end
759
763
760
764
previewer = previewchan === nothing ? nothing :
761
765
@async try
762
766
timer = [' |' , ' /' , ' -' , ' \\ ' ]
763
767
cursor = 0
764
768
desc = " "
769
+ id = Int64 (0 )
765
770
finito = false
766
771
767
772
while ! finito && ! interrupted[]
768
773
lock (printlock) do
769
- newdesc = take_latest! (previewchan)
774
+ newid, newdesc = take_latest! (previewchan)
770
775
if newdesc === nothing
771
776
finito = true
772
777
return # no need to sleep before looping
773
778
elseif newdesc != " "
774
779
desc = newdesc
780
+ id = newid
775
781
cursor = 0
776
782
gotprinted = false
777
783
elseif gotprinted
@@ -805,8 +811,9 @@ function retest(@nospecialize(args::ArgType...);
805
811
# printer prints
806
812
align_overflow =
807
813
max (align_overflow, textwidth (description) - align)
808
- printstyled (' \r ' ,
809
- rpad (" $description " , align+ align_overflow, " " ),
814
+ print (' \r ' )
815
+ print_id (id, maxidw[])
816
+ printstyled (rpad (" $description " , align+ align_overflow, " " ),
810
817
' ' ,
811
818
timer[mod1 (cursor, end )];
812
819
style... )
@@ -857,7 +864,7 @@ function retest(@nospecialize(args::ArgType...);
857
864
rts = take! (outchan)
858
865
lock (printlock) do
859
866
if previewchan != = nothing
860
- desc = take_latest! (previewchan)
867
+ id, desc = take_latest! (previewchan)
861
868
if desc === nothing
862
869
# keep `nothing` in so that the previewer knows to terminate
863
870
put! (previewchan, nothing )
@@ -967,7 +974,7 @@ function retest(@nospecialize(args::ArgType...);
967
974
desc = " \0 " * desc
968
975
# even when nworkers() >= 2, we inform the previewer that
969
976
# computation is gonna happen, so the wheel can start spinning
970
- put! (previewchan, desc)
977
+ put! (previewchan, (ts . id, desc) )
971
978
end
972
979
973
980
chan = (out= outchan, compute= computechan, preview= previewchan)
@@ -1351,10 +1358,7 @@ function dryrun(mod::Module, ts::TestsetExpr, pat::Pattern, align::Int=0, parent
1351
1358
1352
1359
res = get (ts. pastresults, subject, nothing )
1353
1360
if show
1354
- if maxidw > 0 # width (ndigits) of max id; <= 0 means ids not printed
1355
- printstyled (lpad (ts. id, maxidw), " | " , color = :light_black , bold= true )
1356
- end
1357
-
1361
+ print_id (ts. id, maxidw)
1358
1362
printstyled (' ' ^ align, desc, color = desc isa String ? :normal : Base. warn_color ())
1359
1363
1360
1364
if repeated != = nothing
0 commit comments