X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=room_test.go;h=d94e8d49634d24ef836cbb899d31bff9752b4a23;hb=0b8c40aa61e899edb3e563b7771e3d7927d6e859;hp=3de419550ac0b0082b18776e8b45eb14ac467dc5;hpb=990937d451208b0299246c46dd29adf7a35f97ee;p=goircd.git diff --git a/room_test.go b/room_test.go index 3de4195..d94e8d4 100644 --- a/room_test.go +++ b/room_test.go @@ -1,3 +1,21 @@ +/* +goircd -- minimalistic simple Internet Relay Chat (IRC) server +Copyright (C) 2014-2015 Sergey Matveev + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + package main import ( @@ -38,8 +56,8 @@ func TestTwoUsers(t *testing.T) { go client1.Processor(events) go client2.Processor(events) - conn1.inbound <- "NICK nick1\r\nUSER foo1 bar1 baz1 :Long name1\r\n" - conn2.inbound <- "NICK nick2\r\nUSER foo2 bar2 baz2 :Long name2\r\n" + conn1.inbound <- "NICK nick1\r\nUSER foo1 bar1 baz1 :Long name1" + conn2.inbound <- "NICK nick2\r\nUSER foo2 bar2 baz2 :Long name2" for i := 0; i < 6; i++ { <-conn1.outbound <-conn2.outbound @@ -87,6 +105,7 @@ func TestTwoUsers(t *testing.T) { conn1.inbound <- "PRIVMSG nick2 :Hello" conn1.inbound <- "PRIVMSG #foo :world" conn1.inbound <- "NOTICE #foo :world" + <-conn2.outbound if r := <-conn2.outbound; r != ":nick1!foo1@someclient PRIVMSG nick2 :Hello\r\n" { t.Fatal("first message", r) } @@ -109,7 +128,7 @@ func TestJoin(t *testing.T) { client := NewClient(&host, conn) go client.Processor(events) - conn.inbound <- "NICK nick2\r\nUSER foo2 bar2 baz2 :Long name2\r\n" + conn.inbound <- "NICK nick2\r\nUSER foo2 bar2 baz2 :Long name2" for i := 0; i < 6; i++ { <-conn.outbound }