TeensyMud - 'A ruby mud server.'

Browse repository
back

test_colorfilter.rb

# 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