Sha256: 64e196bb1affbdfa3165c70054618eef889e2dbf9f275326ebb9a4099155b2de
Contents?: true
Size: 1.47 KB
Versions: 1
Compression:
Stored size: 1.47 KB
Contents
require_relative '../setup' module TestLogging module TestLayouts class TestNestedExceptions < Test::Unit::TestCase include LoggingTestCase def test_basic_format_obj begin raise StandardError, 'nested exception' rescue raise Exception, 'root exception' end rescue Exception => e layout = Logging.layouts.basic({}) log = layout.format_obj(e) assert_not_nil log.index('<Exception> root exception') if defined? e.cause assert_not_nil log.index('<StandardError> nested exception') assert_operator log.index('<Exception> root exception'), :<, log.index('<StandardError> nested exception') end end def test_parseable_format_obj begin raise StandardError, 'nested exception' rescue raise Exception, 'root exception' end rescue Exception => e layout = Logging.layouts.parseable.new log = layout.format_obj(e) assert_equal Exception.name, log[:class] assert_equal 'root exception', log[:message] assert_operator log[:backtrace].size, :>, 0 if defined? e.cause assert_not_nil log[:cause] log = log[:cause] assert_equal StandardError.name, log[:class] assert_equal 'nested exception', log[:message] assert_nil log[:cause] assert_operator log[:backtrace].size, :>, 0 end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
logging-2.2.1 | test/layouts/test_nested_exceptions.rb |