Skip to content

Commit

Permalink
Add tests for capturing exceptions during show()
Browse files Browse the repository at this point in the history
  • Loading branch information
NHDaly committed Jan 9, 2025
1 parent 5c0ec7d commit 6bf54db
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/corelogging.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ end
@test_logs (Info,"the msg") logmsg()
@test only(collect_test_logs(logmsg)[1]).kwargs[:x] === "the y"
end

# Exceptions in log handling (printing) of msg are caught by default
struct Foo end
Base.show(::IO, ::Foo) = 1 ÷ 0
@test_logs (Error, Test.Ignored(), Test.Ignored(), :logevent_error) catch_exceptions=true @info Foo()
# Exceptions in log handling (printing) of attributes are caught by default
@test_logs (Error, Test.Ignored(), Test.Ignored(), :logevent_error) catch_exceptions=true @info "foo" x=Foo()
end

@testset "Special keywords" begin
Expand Down

0 comments on commit 6bf54db

Please sign in to comment.