summaryrefslogtreecommitdiffstats
path: root/test/logger
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-09-23 14:12:42 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-09-23 14:12:42 +0000
commit3d69d318934beaf330e0ec7670606318a49e3c40 (patch)
tree9f9047c7f6c90730fa200165c4c548bea323161c /test/logger
parentaadc4feba1d160b514cc3a88f6caeae54a120195 (diff)
downloadruby-3d69d318934beaf330e0ec7670606318a49e3c40.tar.gz
ruby-3d69d318934beaf330e0ec7670606318a49e3c40.tar.xz
ruby-3d69d318934beaf330e0ec7670606318a49e3c40.zip
* lib/logger.rb: add Logger#<<(msg) for writing msg without any formatting.
* test/logger/test_logger.rb: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/logger')
-rw-r--r--test/logger/test_logger.rb21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/logger/test_logger.rb b/test/logger/test_logger.rb
index afaa05755..339a72e86 100644
--- a/test/logger/test_logger.rb
+++ b/test/logger/test_logger.rb
@@ -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