Skip to content

Commit 1d4f78d

Browse files
committed
fix impossible "$x" descriptions containing only interpolations
1 parent 6ec30c1 commit 1d4f78d

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/ReTest.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,13 @@ function resolve!(mod::Module, ts::TestsetExpr, rx::Regex;
159159
ts.run = true
160160
if shown
161161
# set ts.descwidth to a lower bound to reduce misalignment
162-
ts.descwidth = 2*depth + mapreduce(textwidth, +,
163-
filter(x -> x isa String, desc.args))
162+
ts.descwidth = 2*depth + mapreduce(+, desc.args) do part
163+
if part isa String
164+
textwidth(part)
165+
else
166+
4 # give 4 spaces for unknown string part
167+
end
168+
end
164169
end
165170
end
166171

test/runtests.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,20 +481,24 @@ end
481481
@test true
482482
push!(RUN, 5)
483483
end
484+
@testset "$i" begin # must work even "$i" is made only of Expr (no String parts)
485+
@test true
486+
push!(RUN, 6)
487+
end
484488
end
485489
end # InterpolateImpossible
486490

487491
retest(InterpolateImpossible, dry=true)
488492
retest(InterpolateImpossible)
489-
@test InterpolateImpossible.RUN == 1:5
493+
@test InterpolateImpossible.RUN == 1:6
490494
empty!(InterpolateImpossible.RUN)
491495

492496
retest(InterpolateImpossible, "0")
493-
@test InterpolateImpossible.RUN == 1:5
497+
@test InterpolateImpossible.RUN == 1:6
494498
empty!(InterpolateImpossible.RUN)
495499

496500
retest(InterpolateImpossible, "4") # should have a warning or two
497-
@test InterpolateImpossible.RUN == 4:5
501+
@test InterpolateImpossible.RUN == 4:6
498502

499503

500504
### Failing ##################################################################

0 commit comments

Comments
 (0)