Skip to content
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 breaks push/pop_testset invariance #32937

Closed
tkf opened this issue Aug 17, 2019 · 0 comments · Fixed by #36046
Closed

break breaks push/pop_testset invariance #32937

tkf opened this issue Aug 17, 2019 · 0 comments · Fixed by #36046
Labels
bug Indicates an unexpected problem or unintended behavior testsystem The unit testing framework and Test stdlib

Comments

@tkf
Copy link
Member

tkf commented Aug 17, 2019

julia> using Test

julia> @testset for i in 1:1
           @testset begin
               break
           end
       end
1-element Array{Any,1}:
 Test.DefaultTestSet("i = 1", Any[Test.DefaultTestSet(#= circular reference @-2 =#)], 0, false)

julia> Test.get_testset_depth()  # != 0
1

julia> @testset for i in 1:1  # same testset again
           @testset begin
               break
           end
       end
1-element Array{Any,1}:
 Test.DefaultTestSet("i = 1", Any[Test.DefaultTestSet(#= circular reference @-2 =#)], 0, false)

julia> Test.get_testset_depth()  # != 0
2

I think the code above should be an error. Maybe @testset should be lowered into an "immediately invoked function expression"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior testsystem The unit testing framework and Test stdlib
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants