summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-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 afaa05755f..339a72e867 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