Sha256: 29a97e7bb74834783462951c246a28a44f56b4893d29b29e5736eb732cffe6b4

Contents?: true

Size: 1.89 KB

Versions: 43

Compression:

Stored size: 1.89 KB

Contents

require File.expand_path('../setup', File.dirname(__FILE__))

module TestLogging
module TestAppenders

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

    def test_initialize
      assert_raise(RuntimeError) { Logging::Appenders::Console.new("test") }
    end
  end

  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

Version data entries

43 entries across 36 versions & 4 rubygems

Version Path
vagrant-unbundled-2.2.9.0 vendor/bundle/ruby/2.7.0/gems/logging-2.2.2/test/appenders/test_console.rb
vagrant-unbundled-2.2.8.0 vendor/bundle/ruby/2.7.0/gems/logging-2.2.2/test/appenders/test_console.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.6.0/gems/logging-2.2.2/test/appenders/test_console.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/logging-2.2.2/test/appenders/test_console.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.7.0/gems/logging-2.2.2/test/appenders/test_console.rb
vagrant-unbundled-2.2.6.2 vendor/bundle/ruby/2.6.0/gems/logging-2.2.2/test/appenders/test_console.rb
vagrant-unbundled-2.2.6.1 vendor/bundle/ruby/2.6.0/gems/logging-2.2.2/test/appenders/test_console.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.6.0/gems/logging-2.2.2/test/appenders/test_console.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/gems/logging-2.2.2/test/appenders/test_console.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.6.0/gems/logging-2.2.2/test/appenders/test_console.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/gems/logging-2.2.2/test/appenders/test_console.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.6.0/gems/logging-2.2.2/test/appenders/test_console.rb
vagrant-unbundled-2.2.3.0 vendor/bundle/ruby/2.5.0/gems/logging-2.2.2/test/appenders/test_console.rb
vagrant-unbundled-2.2.2.0 vendor/bundle/ruby/2.5.0/gems/logging-2.2.2/test/appenders/test_console.rb
vagrant-unbundled-2.2.0.0 vendor/bundle/ruby/2.5.0/gems/logging-2.2.2/test/appenders/test_console.rb
vagrant-unbundled-2.1.4.0 vendor/bundle/ruby/2.5.0/gems/logging-2.2.2/test/appenders/test_console.rb
vagrant-unbundled-2.1.2.0 vendor/bundle/ruby/2.3.0/gems/logging-2.2.2/test/appenders/test_console.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/logging-2.2.2/test/appenders/test_console.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/logging-2.2.2/test/appenders/test_console.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/logging-2.2.2/test/appenders/test_console.rb