Skip to content

Commit

Permalink
Add a test for JuliaLang#17462, break/continue in a testset for
Browse files Browse the repository at this point in the history
Add some counters to make sure things actually execute
  • Loading branch information
tkelman authored and mfasi committed Sep 5, 2016
1 parent ea860b9 commit 931fc5d
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -313,3 +313,28 @@ end
@test @inferred(inferrable_kwtest(1; y=1)) == 2
@test @inferred(uninferrable_kwtest(1)) == 3
@test_throws ErrorException @inferred(uninferrable_kwtest(1; y=2)) == 2

# Issue #17462
counter_17462_pre = 0
counter_17462_post = 0
@testset for x in [1,2,3,4]
counter_17462_pre += 1
if x == 1
@test counter_17462_pre == x
continue
@test false
elseif x == 3
@test counter_17462_pre == x
break
@test false
elseif x == 4
@test false
else
@test counter_17462_pre == x
@test x == 2
@test counter_17462_post == 0
end
counter_17462_post += 1
end
@test counter_17462_pre == 3
@test counter_17462_post == 1

0 comments on commit 931fc5d

Please sign in to comment.