Skip to content

Commit 029f751

Browse files
committed
client: adjust TestClientAuthTrimSpace comments
This doesn't test a zero-byte SASL initial response, this tests a missing SASL initial response.
1 parent dd39b35 commit 029f751

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

client_test.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ import (
2020
"github.com/emersion/go-sasl"
2121
)
2222

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
2425
func TestClientAuthTrimSpace(t *testing.T) {
2526
server := "220 hello world\r\n" +
2627
"200 some more"
@@ -35,24 +36,24 @@ func TestClientAuthTrimSpace(t *testing.T) {
3536
}
3637
c := NewClient(fake)
3738
c.didHello = true
38-
c.Auth(toServerEmptyAuth{})
39+
c.Auth(toServerNoRespAuth{})
3940
c.Close()
4041
if got, want := wrote.String(), "AUTH FOOAUTH\r\n*\r\n"; got != want {
4142
t.Errorf("wrote %q; want %q", got, want)
4243
}
4344
}
4445

45-
// toServerEmptyAuth is an implementation of Auth that only implements
46+
// toServerNoRespAuth is an implementation of Auth that only implements
4647
// 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{}
5051

51-
func (toServerEmptyAuth) Start() (proto string, toServer []byte, err error) {
52+
func (toServerNoRespAuth) Start() (proto string, toServer []byte, err error) {
5253
return "FOOAUTH", nil, nil
5354
}
5455

55-
func (toServerEmptyAuth) Next(fromServer []byte) (toServer []byte, err error) {
56+
func (toServerNoRespAuth) Next(fromServer []byte) (toServer []byte, err error) {
5657
panic("unexpected call")
5758
}
5859

0 commit comments

Comments
 (0)