Sha256: 35bb7a718cae9d493dea9ab675e12d253bcae69dc5e5e6e2fc222b043a564b9a

Contents?: true

Size: 995 Bytes

Versions: 3

Compression:

Stored size: 995 Bytes

Contents

require "include"

class TestFormatter < TestCase
  def test_creation
    assert_no_exception { Formatter.new.format(3) }
    assert_no_exception { DefaultFormatter.new }
    assert_kind_of(Formatter, DefaultFormatter.new)
  end
  def test_simple_formatter
    sf = SimpleFormatter.new
    f = Logger.new('simple formatter')
    event = LogEvent.new(0, f, nil, "some data")
    assert_match(sf.format(event), /simple formatter/)
  end
  def test_basic_formatter
    b = BasicFormatter.new
    f = Logger.new('fake formatter')
    event = LogEvent.new(0, f, caller, "fake formatter")
    event2 = LogEvent.new(0, f, nil, "fake formatter")
    # this checks for tracing
    assert_match(b.format(event), /in/)
    assert_not_match(b.format(event2), /in/)
    e = ArgumentError.new("argerror")
    e.set_backtrace ['backtrace']
    event3 = LogEvent.new(0, f, nil, e)
    assert_match(b.format(event3), /ArgumentError/)
    assert_match(b.format(LogEvent.new(0,f,nil,[1,2,3])), /Array/)
  end
end 

Version data entries

3 entries across 3 versions & 3 rubygems

Version Path
revolutionhealth-log4r-2.0.0 test/orig_tests/testformatter.rb
sml-log4r-1.0.6 tests/testformatter.rb
riess-0.0.8 vendor/log4r-1.0.5/tests/testformatter.rb