mirror of https://github.com/fluffle/goirc
Better line ending handling in MockNetConn.
This commit is contained in:
parent
83da879ad3
commit
b8c3f42252
|
@ -3,6 +3,7 @@ package client
|
||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
@ -81,7 +82,8 @@ func (m *mockNetConn) Expect(e string) {
|
||||||
"Expected: '%s', got nothing.", e)
|
"Expected: '%s', got nothing.", e)
|
||||||
case s := <-m.Out:
|
case s := <-m.Out:
|
||||||
t.Stop()
|
t.Stop()
|
||||||
if e + "\r\n" != s {
|
s = strings.Trim(s, "\r\n")
|
||||||
|
if e != s {
|
||||||
m.Errorf("Mock connection received unexpected value.\n\t" +
|
m.Errorf("Mock connection received unexpected value.\n\t" +
|
||||||
"Expected: '%s'\n\tGot: '%s'", e, s)
|
"Expected: '%s'\n\tGot: '%s'", e, s)
|
||||||
}
|
}
|
||||||
|
@ -94,6 +96,7 @@ func (m *mockNetConn) ExpectNothing() {
|
||||||
case <-t.C:
|
case <-t.C:
|
||||||
case s := <-m.Out:
|
case s := <-m.Out:
|
||||||
t.Stop()
|
t.Stop()
|
||||||
|
s = strings.Trim(s, "\r\n")
|
||||||
m.Errorf("Mock connection received unexpected output.\n\t" +
|
m.Errorf("Mock connection received unexpected output.\n\t" +
|
||||||
"Expected nothing, got: '%s'", s)
|
"Expected nothing, got: '%s'", s)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue