From 54bd4900d66ed2afd7d39e94e850f086787f9f9c Mon Sep 17 00:00:00 2001 From: Arhik Date: Fri, 14 Jun 2024 23:26:54 +0530 Subject: [PATCH] fielderrorshim naive version --- stdlib/Test/src/Test.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stdlib/Test/src/Test.jl b/stdlib/Test/src/Test.jl index 5b4bd1177ac7a..22f9474a377da 100644 --- a/stdlib/Test/src/Test.jl +++ b/stdlib/Test/src/Test.jl @@ -797,7 +797,7 @@ 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) @@ -805,6 +805,8 @@ function do_test_throws(result::ExecutionResult, orig_expr, extype) 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