Skip to content

Commit

Permalink
Add logdevio tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ganmacs committed Sep 16, 2016
1 parent d8aef3b commit 20978f2
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/test_log.rb
Original file line number Diff line number Diff line change
Expand Up @@ -602,3 +602,41 @@ def test_terminate
plugin.terminate
end
end

class LogDeviceIOTest < Test::Unit::TestCase
test 'flush' do
io = StringIO.new
logdev = Fluent::LogDeviceIO.new(io)
assert_equal io, logdev.flush

io.instance_eval { undef :flush }
logdev = Fluent::LogDeviceIO.new(io)
assert_raise NoMethodError do
logdev.flush
end
end

test 'tty?' do
io = StringIO.new
logdev = Fluent::LogDeviceIO.new(io)
assert_equal io.tty?, logdev.tty?

io.instance_eval { undef :tty? }
logdev = Fluent::LogDeviceIO.new(io)
assert_raise NoMethodError do
logdev.tty?
end
end

test 'sync=' do
io = StringIO.new
logdev = Fluent::LogDeviceIO.new(io)
assert_true logdev.sync = true

io.instance_eval { undef :sync= }
logdev = Fluent::LogDeviceIO.new(io)
assert_raise NoMethodError do
logdev.sync = true
end
end
end

0 comments on commit 20978f2

Please sign in to comment.