Skip to content

Commit

Permalink
fielderrorshim
Browse files Browse the repository at this point in the history
naive version
  • Loading branch information
arhik committed Jun 14, 2024
1 parent d654415 commit 54bd490
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion stdlib/Test/src/Test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -797,14 +797,16 @@ function do_test_throws(result::ExecutionResult, orig_expr, extype)
orig_expr isa Expr &&
orig_expr.head in (:call, :macrocall) &&
orig_expr.args[1] in MACROEXPAND_LIKE
if isa(extype, Type)
if isa(extype, Type) && extype != ErrorException
success =
if from_macroexpand && extype == LoadError && exc isa Exception
Base.depwarn("macroexpand no longer throws a LoadError so `@test_throws LoadError ...` is deprecated and passed without checking the error type!", :do_test_throws)
true
else
isa(exc, extype)
end
elseif isa(extype, Type) && extype == ErrorException
success = isa(exc, ErrorException) || isa(exc, FieldError)
elseif isa(extype, Exception) || !isa(exc, Exception)
if extype isa LoadError && !(exc isa LoadError) && typeof(extype.error) == typeof(exc)
extype = extype.error # deprecated
Expand Down

0 comments on commit 54bd490

Please sign in to comment.