mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/logger] Fix to use logger and test-unit in this repo with
`ruby test/logger/test_xxx.rb` https://github.com/ruby/logger/commit/d3c2402340
This commit is contained in:
parent
47500f2055
commit
136196785b
4 changed files with 11 additions and 9 deletions
5
test/helper.rb
Normal file
5
test/helper.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
ROOT_DIR = File.dirname(__dir__)
|
||||
$LOAD_PATH.unshift File.join(ROOT_DIR, 'lib') # to use logger in this repo instead of ruby built-in logger
|
||||
$LOAD_PATH.unshift File.join(ROOT_DIR, 'test', 'lib') # to use custom test-unit in this repo
|
||||
require 'logger'
|
||||
require 'test/unit'
|
|
@ -1,7 +1,6 @@
|
|||
# coding: US-ASCII
|
||||
# frozen_string_literal: false
|
||||
require 'test/unit'
|
||||
require 'logger'
|
||||
require_relative '../helper'
|
||||
require 'tempfile'
|
||||
require 'tmpdir'
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# coding: US-ASCII
|
||||
# frozen_string_literal: false
|
||||
require 'test/unit'
|
||||
require 'logger'
|
||||
require_relative '../helper'
|
||||
require 'tempfile'
|
||||
|
||||
class TestLogger < Test::Unit::TestCase
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# coding: US-ASCII
|
||||
# frozen_string_literal: false
|
||||
require 'test/unit'
|
||||
require 'logger'
|
||||
require_relative '../helper'
|
||||
|
||||
class TestLoggerSeverity < Test::Unit::TestCase
|
||||
def test_enum
|
||||
|
@ -13,13 +12,13 @@ class TestLoggerSeverity < Test::Unit::TestCase
|
|||
end
|
||||
assert_equal(levels.size, Logger::Severity.constants.size)
|
||||
end
|
||||
|
||||
|
||||
def test_level_assignment
|
||||
logger = Logger.new(nil)
|
||||
|
||||
|
||||
Logger::Severity.constants.each do |level|
|
||||
next if level == :UNKNOWN
|
||||
|
||||
|
||||
logger.send("#{level.downcase}!")
|
||||
assert(logger.level) == Logger::Severity.const_get(level)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue