Sha256: 93fc36b0953e72cc7e29f82da15dfac59c74fb8b93165abf810bc2df26a20f5b

Contents?: true

Size: 1.71 KB

Versions: 31

Compression:

Stored size: 1.71 KB

Contents

require File.join(File.dirname(__FILE__), %w[.. setup])

module TestLogging
module TestAppenders

  class TestStdout < Test::Unit::TestCase
    include LoggingTestCase

    def test_initialize
      Logging::Repository.instance

      appender = Logging.appenders.stdout
      assert_equal 'stdout', appender.name
      assert_same STDOUT, appender.instance_variable_get(:@io)

      appender.close
      assert_equal true, appender.closed?
      assert_equal false, STDOUT.closed?

      appender = Logging.appenders.stdout('foo')
      assert_equal 'foo', appender.name

      appender = Logging.appenders.stdout(:level => :warn)
      assert_equal 'stdout', appender.name
      assert_equal 2, appender.level

      appender = Logging.appenders.stdout('bar', :level => :error)
      assert_equal 'bar', appender.name
      assert_equal 3, appender.level
    end

  end  # class TestStdout

  class TestStderr < Test::Unit::TestCase
    include LoggingTestCase

    def test_initialize
      Logging::Repository.instance

      appender = Logging.appenders.stderr
      assert_equal 'stderr', appender.name
      assert_same STDERR, appender.instance_variable_get(:@io)

      appender.close
      assert_equal true, appender.closed?
      assert_equal false, STDERR.closed?

      appender = Logging.appenders.stderr('foo')
      assert_equal 'foo', appender.name

      appender = Logging.appenders.stderr(:level => :warn)
      assert_equal 'stderr', appender.name
      assert_equal 2, appender.level

      appender = Logging.appenders.stderr('bar', :level => :error)
      assert_equal 'bar', appender.name
      assert_equal 3, appender.level
    end

  end  # class TestStderr

end  # module TestAppenders
end  # module TestLogging

# EOF

Version data entries

31 entries across 31 versions & 5 rubygems

Version Path
pjstadig-logging-1.1.4.2 test/appenders/test_console.rb
logging-1.2.3 test/appenders/test_console.rb
logging-1.2.2 test/appenders/test_console.rb
logging-1.2.0 test/appenders/test_console.rb
logging-1.2.1 test/appenders/test_console.rb
logging-1.0.0 test/appenders/test_console.rb
logging-1.1.4 test/appenders/test_console.rb
logging-1.1.2 test/appenders/test_console.rb
logging-1.1.1 test/appenders/test_console.rb
logging-1.1.0 test/appenders/test_console.rb
logging-1.1.3 test/appenders/test_console.rb