1
0
Fork 0
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:
sonots 2019-03-18 19:34:01 +09:00 committed by Hiroshi SHIBATA
parent 47500f2055
commit 136196785b
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
4 changed files with 11 additions and 9 deletions

5
test/helper.rb Normal file
View 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'

View file

@ -1,7 +1,6 @@
# coding: US-ASCII
# frozen_string_literal: false
require 'test/unit'
require 'logger'
require_relative '../helper'
require 'tempfile'
require 'tmpdir'

View file

@ -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

View file

@ -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