test_colorfilter.rb
znmud-0.0.1/test/test_colorfilter.rb · 702 B
From the archive znmud-minimal-0.0.1.tar.gz
Download the archive « Back to the archive contents
# Code Generated by ZenTest v. 2.3.0
# classname: asrt / meth = ratio%
# ColorFilter: 2 / 2 = 100.00%
unless defined? $ZENTEST and $ZENTEST
require 'test/unit'
require 'network/protocol/colorfilter'
require 'flexmock'
end
class TestColorFilter < Test::Unit::TestCase
def setup
@color = false
@pstack = FlexMock.new
@pstack.mock_handle(:color_on) { @color = !@color }
@filter = ColorFilter.new(@pstack)
end
def test_filter_out
assert_equal("\e[0;30mhello\e[0m",
@filter.filter_out("[COLOR Black]hello[/COLOR]"))
assert_equal("hello",
@filter.filter_out("[COLOR Black]hello[/COLOR]"))
end
end