@@ -20,7 +20,8 @@ import (
20
20
"github.com/emersion/go-sasl"
21
21
)
22
22
23
- // Issue 17794: don't send a trailing space on AUTH command when there's no password.
23
+ // Don't send a trailing space on AUTH command when there's no initial response:
24
+ // https://github.com/golang/go/issues/17794
24
25
func TestClientAuthTrimSpace (t * testing.T ) {
25
26
server := "220 hello world\r \n " +
26
27
"200 some more"
@@ -35,24 +36,24 @@ func TestClientAuthTrimSpace(t *testing.T) {
35
36
}
36
37
c := NewClient (fake )
37
38
c .didHello = true
38
- c .Auth (toServerEmptyAuth {})
39
+ c .Auth (toServerNoRespAuth {})
39
40
c .Close ()
40
41
if got , want := wrote .String (), "AUTH FOOAUTH\r \n *\r \n " ; got != want {
41
42
t .Errorf ("wrote %q; want %q" , got , want )
42
43
}
43
44
}
44
45
45
- // toServerEmptyAuth is an implementation of Auth that only implements
46
+ // toServerNoRespAuth is an implementation of Auth that only implements
46
47
// the Start method, and returns "FOOAUTH", nil, nil. Notably, it returns
47
- // zero bytes for "toServer" so we can test that we don't send spaces at
48
- // the end of the line. See TestClientAuthTrimSpace.
49
- type toServerEmptyAuth struct {}
48
+ // nil for "toServer" so we can test that we don't send spaces at the end of
49
+ // the line. See TestClientAuthTrimSpace.
50
+ type toServerNoRespAuth struct {}
50
51
51
- func (toServerEmptyAuth ) Start () (proto string , toServer []byte , err error ) {
52
+ func (toServerNoRespAuth ) Start () (proto string , toServer []byte , err error ) {
52
53
return "FOOAUTH" , nil , nil
53
54
}
54
55
55
- func (toServerEmptyAuth ) Next (fromServer []byte ) (toServer []byte , err error ) {
56
+ func (toServerNoRespAuth ) Next (fromServer []byte ) (toServer []byte , err error ) {
56
57
panic ("unexpected call" )
57
58
}
58
59
0 commit comments