X-Git-Url: http://git.sourceforge.jp/view?p=shogi-server%2Fshogi-server.git;a=blobdiff_plain;f=test%2FTC_command.rb;h=fb2e134c724960675ff8042ebde1499737612a7c;hp=455fdd8441e78d4334d245caac2538bdb363e7fd;hb=335c9f947ec1752b706e416fbd1aab93abd138b6;hpb=e34ece5960e2500fcdf0b7d7accc6cc40f1b6b12 diff --git a/test/TC_command.rb b/test/TC_command.rb index 455fdd8..fb2e134 100644 --- a/test/TC_command.rb +++ b/test/TC_command.rb @@ -210,6 +210,30 @@ class TestFactoryMethod < Test::Unit::TestCase def test_error cmd = ShogiServer::Command.factory("should_be_error", @p) assert_instance_of(ShogiServer::ErrorCommand, cmd) + cmd.call + assert_match /unknown command should_be_error/, cmd.msg + end + + def test_error_login + cmd = ShogiServer::Command.factory("LOGIN hoge foo", @p) + assert_instance_of(ShogiServer::ErrorCommand, cmd) + cmd.call + assert_no_match /unknown command LOGIN hoge foo/, cmd.msg + + cmd = ShogiServer::Command.factory("LOGin hoge foo", @p) + assert_instance_of(ShogiServer::ErrorCommand, cmd) + cmd.call + assert_no_match /unknown command LOGIN hoge foo/, cmd.msg + + cmd = ShogiServer::Command.factory("LOGIN hoge foo", @p) + assert_instance_of(ShogiServer::ErrorCommand, cmd) + cmd.call + assert_no_match /unknown command LOGIN hoge foo/, cmd.msg + + cmd = ShogiServer::Command.factory("LOGINhoge foo", @p) + assert_instance_of(ShogiServer::ErrorCommand, cmd) + cmd.call + assert_no_match /unknown command LOGIN hoge foo/, cmd.msg end end