-
-
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
Base.Test does not support continue statement #17908
Comments
Related #17462? |
I get the same with |
The consequences for my PR are that I need to rebase anyway. IIRC we don't have any To expand a bit, most of the changes I made in that PR to |
Does anyone know the |
It seems that it'll actually not miss any failing tests at least... |
And the main issue here is that julia> f_return() = for i in 1:10
try
return
finally
println(i)
end
end
f_return (generic function with 1 method)
julia> f_break() = for i in 1:10
try
break
finally
println(i)
end
end
f_break (generic function with 1 method)
julia> f_continue() = for i in 1:10
try
continue
finally
println(i)
end
end
f_continue (generic function with 1 method)
julia> f_return()
1
julia> f_break()
julia> f_continue() |
Yeah, almost. Once #12806 is fixed the following patch should fix the issue for testset. (The patch currently makes no difference) diff --git a/base/test.jl b/base/test.jl
index 7d23115..04a4015 100644
--- a/base/test.jl
+++ b/base/test.jl
@@ -728,14 +728,14 @@ function testset_forloop(args, testloop)
# Something in the test block threw an error. Count that as an
# error in this test set
record(ts, Error(:nontest_error, :(), err, catch_backtrace()))
+ finally
+ pop_testset()
+ push!(arr, finish(ts))
end
- pop_testset()
- finish(ts)
end
quote
arr = Array{Any,1}(0)
- $(Expr(:for, Expr(:block, [esc(v) for v in loopvars]...),
- :(push!(arr, $blk))))
+ $(Expr(:for, Expr(:block, [esc(v) for v in loopvars]...), blk))
arr
end
end |
There's probably a way to trick it to do the right thing though, let me have a try. |
x-ref #13660 for past attempt, some discussion and good test cases |
Yeah I saw that PR. By trick I actually mean rearrange the code for testset to fix it without fixing lowering. Anyway, seems to be working, just need to figure out a way to test it. |
Using
Base.Test
on master,results in
as expected. However, adding a continue statement set to trigger on
i=2
, causes the wholetestset
to stop oni=2
and not continue toi=3
.results in
Furthermore, once I have run one
testset
in a REPL that contained a call tocontinue
, any regular (non-continued) testset now returnsNothing
. i.e.returns
and does not print any test results to the terminal.
I can confirm that this also happens on
release-0.5
Maybe having the continue statement not interact with a
testset
is by design, but having onetestset
with a continue make all future REPLtestset
's not correct is definitely a bug.The text was updated successfully, but these errors were encountered: