-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
break/continue in a @testset for loop is broken #17462
Comments
Jeff, did you see this one? |
Ah, it looks like testset generates a comprehension expecting to be able to drop a |
cc @IainNZ if you know the answer - BaseTestNext may have a still-working implementation on 0.4? |
Here's a patch to try, that just collects results for all iterations that finish: --- a/base/test.jl
+++ b/base/test.jl
@@ -732,7 +732,12 @@ function testset_forloop(args, testloop)
pop_testset()
finish(ts)
end
- Expr(:comprehension, blk, [esc(v) for v in loopvars]...)
+ quote
+ arr = Array{Any,1}(0)
+ $(Expr(:for, Expr(:block, [esc(v) for v in loopvars]...),
+ :(push!(arr, $blk))))
+ arr
+ end
end |
The syntax looks just like a loop so being able to break is expected. It is also nifty if you want to skip tests based on some condition. Of course not an essential feature but it used to work so... |
Nobody is arguing with that as far as I can tell... |
I misunderstood your comment about "Is that needed behaviour" as asking about being able to break in a test loop at all. I see now what you meant, my apologies. |
|
why not? it's useful, I think jeff's patch and the minimal test here make sense. |
Add some counters to make sure things actually execute
Fix #17462, break/continue in an at-testset for loop
make the macro return a :for instead of a :comprehension
Add some counters to make sure things actually execute
As @tkelman reported here: KristofferC/NearestNeighbors.jl#25 (and kindly bisected to cd35df536bd) Julia master now does not support
break
orcontinue
in a@testset
for loopcc @JeffBezanson since it got bisected to commit that was authored by you
The text was updated successfully, but these errors were encountered: