1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-30 18:13:54 +08:00

removed logging in conn_test

This commit is contained in:
Juan Batiz-Benet
2014-09-11 00:59:54 -07:00
committed by Brian Tiger Chow
parent c59125b64c
commit ffad3bb6af

View File

@ -1,7 +1,6 @@
package swarm package swarm
import ( import (
"fmt"
"net" "net"
"testing" "testing"
@ -31,7 +30,7 @@ func echoListen(listener *net.TCPListener) {
for { for {
c, err := listener.Accept() c, err := listener.Accept()
if err == nil { if err == nil {
fmt.Println("accepeted") // fmt.Println("accepeted")
go echo(c) go echo(c)
} }
} }
@ -42,15 +41,15 @@ func echo(c net.Conn) {
data := make([]byte, 1024) data := make([]byte, 1024)
i, err := c.Read(data) i, err := c.Read(data)
if err != nil { if err != nil {
fmt.Printf("error %v\n", err) // fmt.Printf("error %v\n", err)
return return
} }
_, err = c.Write(data[:i]) _, err = c.Write(data[:i])
if err != nil { if err != nil {
fmt.Printf("error %v\n", err) // fmt.Printf("error %v\n", err)
return return
} }
fmt.Println("echoing", data[:i]) // fmt.Println("echoing", data[:i])
} }
} }
@ -72,11 +71,11 @@ func TestDial(t *testing.T) {
t.Fatal("error dialing peer", err) t.Fatal("error dialing peer", err)
} }
fmt.Println("sending") // fmt.Println("sending")
c.Outgoing.MsgChan <- []byte("beep") c.Outgoing.MsgChan <- []byte("beep")
c.Outgoing.MsgChan <- []byte("boop") c.Outgoing.MsgChan <- []byte("boop")
out := <-c.Incoming.MsgChan out := <-c.Incoming.MsgChan
fmt.Println("recving", string(out)) // fmt.Println("recving", string(out))
if string(out) != "beep" { if string(out) != "beep" {
t.Error("unexpected conn output") t.Error("unexpected conn output")
} }
@ -86,7 +85,7 @@ func TestDial(t *testing.T) {
t.Error("unexpected conn output") t.Error("unexpected conn output")
} }
fmt.Println("closing") // fmt.Println("closing")
c.Close() c.Close()
listener.Close() listener.Close()
} }