Skip to content

Commit d89e169

Browse files
committed
when not filtering, don't warn when loop iterator can't be eval'ed
1 parent f9db699 commit d89e169

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/ReTest.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ end
115115
function resolve!(mod::Module, ts::TestsetExpr, rx::Regex, force::Bool=false)
116116
strings = empty!(ts.strings)
117117
desc = ts.desc
118-
ts.run = force
118+
ts.run = force || isempty(rx.pattern)
119119
ts.loopvalues = nothing # unnecessary ?
120120

121121
parentstrs = ts.parent === nothing ? [""] : ts.parent.strings
@@ -144,8 +144,10 @@ function resolve!(mod::Module, ts::TestsetExpr, rx::Regex, force::Bool=false)
144144
ts.loopvalues = xs
145145
catch
146146
xs = () # xs might have been assigned before the collect call
147+
if !ts.run
148+
@warn "could not evaluate testset-for iterator, default to inclusion"
149+
end
147150
ts.run = true
148-
@warn "could not evaluate testset-for iterator, default to inclusion"
149151
end
150152
for x in xs # empty loop if eval above threw
151153
ts.run && break

test/runtests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ end
198198
@test_logs (:warn, r"could not evaluate testset-for iterator.*") runtests(Loops1, r"asd")
199199
@test Loops1.RUN == [1, 0, 2, 0]
200200
empty!(Loops1.RUN)
201-
@test_logs (:warn, r"could not evaluate testset-for iterator.*") runtests(Loops1)
201+
runtests(Loops1) # should not log
202202
@test Loops1.RUN == [1, 0, -1, 2, 0, -1]
203203

204204
module Loops2
@@ -226,7 +226,7 @@ end
226226
@test_logs (:warn, r"could not evaluate testset-for iterator.*") runtests(Loops2, r"asd")
227227
@test Loops2.RUN == [1, 0, 2, 0]
228228
empty!(Loops2.RUN)
229-
@test_logs (:warn, r"could not evaluate testset-for iterator.*") runtests(Loops2)
229+
runtests(Loops2)
230230
@test Loops2.RUN == [1, 0, -1, 2, 0, -1]
231231

232232
module Loops3

0 commit comments

Comments
 (0)