Skip to content

Commit

Permalink
Work around change to exception type from lock in 1.2
Browse files Browse the repository at this point in the history
In Julia 1.2, the error that occurs when releasing a semaphore with
mismatched release/acquire counts is now an ErrorException, whereas
previously it was an AssertionError.

See JuliaLang/julia#30061
  • Loading branch information
ararslan committed Feb 19, 2019
1 parent 1c503cd commit b099d7a
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,17 @@ include("utils.jl")
@test "Expected error but no error thrown" == nothing
catch err
@test err isa RemoteException
@test err.captured.ex isa AssertionError

if !isa(err, RemoteException) || !isa(err.captured.ex, AssertionError)
if VERSION >= v"1.2.0-DEV.28"
expected = ErrorException
@test err.captured.ex isa expected
@test occursin("release count must match acquire count", err.captured.ex.msg)
else
expected = AssertionError
@test err.captured.ex isa expected
end

if !isa(err, RemoteException) || !isa(err.captured.ex, expected)
rethrow(err)
end
end
Expand Down Expand Up @@ -80,9 +88,17 @@ end
@test "Expected error but no error thrown" == nothing
catch err
@test err isa RemoteException
@test err.captured.ex isa AssertionError

if !isa(err, RemoteException) || !isa(err.captured.ex, AssertionError)
if VERSION >= v"1.2.0-DEV.28"
expected = ErrorException
@test err.captured.ex isa expected
@test occursin("release count must match acquire count", err.captured.ex.msg)
else
expected = AssertionError
@test err.captured.ex isa expected
end

if !isa(err, RemoteException) || !isa(err.captured.ex, expected)
rethrow(err)
end
end
Expand Down

0 comments on commit b099d7a

Please sign in to comment.