1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/logger.rb: add Logger#<<(msg) for writing msg without any formatting.

* test/logger/test_logger.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nahi 2003-09-23 14:12:42 +00:00
parent 603e0b1f19
commit 406fd7754e
3 changed files with 45 additions and 1 deletions

View file

@ -1,6 +1,5 @@
require 'test/unit'
require 'logger'
GC.start
class TestLoggerSeverity < Test::Unit::TestCase
def test_enum
@ -210,4 +209,24 @@ class TestLogger < Test::Unit::TestCase
log = log_add(logger, INFO, MyMsg.new)
assert_equal("my_msg\n", log.msg)
end
def test_lshift
r, w = IO.pipe
logger = Logger.new(w)
logger << "msg"
read_ready, = IO.select([r], nil, nil, 0.1)
w.close
msg = r.read
r.close
assert_equal("msg", msg)
#
r, w = IO.pipe
logger = Logger.new(w)
logger << "msg2\n\n"
read_ready, = IO.select([r], nil, nil, 0.1)
w.close
msg = r.read
r.close
assert_equal("msg2\n\n", msg)
end
end