Skip to content

Commit 0eef038

Browse files
committed
don't always print module header when only one testset
When only one module was tested and explicitly passed to `retest`, `moduleheader` was false, but we still printed the header when there was only one toplevel testset, so that the module name was printed at least once. But this was not very consistent: depending on the filtering pattern, the module name could be printed either at the beginning or at the end. When the module is passed explicitly, it doesn't seem necessary to print the module name at all, so we only print it at the end when a summary is needed, i.e. more than one toplevel testset was tested.
1 parent 4ec6337 commit 0eef038

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

docs/src/index.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,8 @@ run the tests):
8181
julia> using MyPackage, ReTest
8282

8383
julia> MyPackage.runtests()
84-
Pass
85-
MyPackage:
86-
greet | 1
84+
Pass
85+
greet | 1
8786
```
8887

8988
Suppose now that we organize `MyPackage` as a standard package, with
@@ -149,9 +148,8 @@ Main.MyPackageTests:
149148
Overall | 2
150149

151150
julia> MyPackageTests.runtests(3) # run only testset with ID 3 in MyPackageTests
152-
Pass
153-
Main.MyPackageTests:
154-
3| stuff | 1
151+
Pass
152+
3| stuff | 1
155153
```
156154

157155
Here it is for basic usage!

src/ReTest.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -870,11 +870,9 @@ function retest(@nospecialize(args::ArgType...);
870870

871871
ndone = 0
872872

873-
if moduleheader | !many
873+
if moduleheader
874874
# + if moduleheader, we print the module as a header, to know where the currently
875875
# printed testsets belong
876-
# + if !many, we won't print the overall afterwads, which would be redundant
877-
# with the only one printed top-level testset
878876
ntests += 1
879877
put!(outchan, module_ts) # printer task will take care of feeding computechan
880878
else
@@ -1281,7 +1279,7 @@ function fetchtests((mod, pat), verbose, moduleheader, maxidw; static, strict, d
12811279
tests, descwidth, hasbroken
12821280
end
12831281

1284-
isindented(verbose, moduleheader, many) = (verbose > 0) & (moduleheader | !many)
1282+
isindented(verbose, moduleheader, many) = (verbose > 0) & moduleheader
12851283

12861284
function dryrun(mod::Module, ts::TestsetExpr, pat::Pattern, align::Int=0, parentsubj=""
12871285
; maxidw::Int, # external calls

test/runtests.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -789,10 +789,9 @@ end # MV
789789

790790
@chapter MiscVerbose begin
791791
check(MV, [], output = """
792-
Pass
793-
Main.MV:
794-
outer | 2
795-
inner | 1
792+
Pass
793+
outer | 2
794+
inner | 1
796795
""")
797796
end
798797

0 commit comments

Comments
 (0)