X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=daemon_test.go;h=efdb39fd3e3598dea52a2cd2431bcdadb7a5d8f0;hb=186ec4b4bd91f9fd101b2f62d30c0f2bd4ed50ce;hp=9c9db3de436923a43540debbc7d582374db58a43;hpb=41f96494948d1f9f1e0c3066099e0bd9ad0ee8dd;p=goircd.git diff --git a/daemon_test.go b/daemon_test.go index 9c9db3d..efdb39f 100644 --- a/daemon_test.go +++ b/daemon_test.go @@ -1,6 +1,6 @@ /* goircd -- minimalistic simple Internet Relay Chat (IRC) server -Copyright (C) 2014 Sergey Matveev +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 @@ -15,6 +15,7 @@ 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 ( @@ -25,11 +26,12 @@ import ( ) func TestRegistrationWorkflow(t *testing.T) { - daemon := NewDaemon("foohost", "", nil, nil) + host := "foohost" + daemon := NewDaemon("ver1", &host, nil, nil, nil, nil) events := make(chan ClientEvent) go daemon.Processor(events) conn := NewTestingConn() - client := NewClient("foohost", conn) + client := NewClient(&host, conn) go client.Processor(events) conn.inbound <- "UNEXISTENT CMD" // should recieve nothing on this @@ -89,6 +91,7 @@ func TestRegistrationWorkflow(t *testing.T) { conn.inbound <- "AWAY" conn.inbound <- "UNEXISTENT CMD" + <-conn.outbound if r := <-conn.outbound; r != ":foohost 421 meinick UNEXISTENT :Unknown command\r\n" { t.Fatal("reply for unexistent command", r) } @@ -119,8 +122,10 @@ func TestMotd(t *testing.T) { fd.WriteString("catched\n") conn := NewTestingConn() - client := NewClient("foohost", conn) - daemon := NewDaemon("foohost", fd.Name(), nil, nil) + host := "foohost" + client := NewClient(&host, conn) + motdName := fd.Name() + daemon := NewDaemon("ver1", &host, &motdName, nil, nil, nil) daemon.SendMotd(client) if r := <-conn.outbound; !strings.HasPrefix(r, ":foohost 375") {