1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-09 01:18:39 +03:00
lvm2/report-generators/test/tc_log.rb
2010-07-20 14:38:44 +00:00

27 lines
463 B
Ruby

require 'test/unit'
require 'stringio'
require 'log'
class TestLog < Test::Unit::TestCase
include Log
private
def remove_timestamps(l)
l.gsub(/\[[^\]]*\]/, '')
end
public
def test_log
StringIO.open do |out|
init(out)
info("msg1")
warning("msg2")
debug("msg3")
assert_equal("I, INFO -- : msg1\nW, WARN -- : msg2\nD, DEBUG -- : msg3\n",
remove_timestamps(out.string))
end
end
end