Add DialWithOptions

DialWithOptions accept a variadic number of options, allowing to
introduce more options in the fure without breaking the API.
This commit is contained in:
Julien Laffaye
2019-04-10 20:25:16 +02:00
parent 55546487cf
commit 04b1878733
3 changed files with 126 additions and 44 deletions

View File

@@ -285,14 +285,14 @@ func (mock *ftpMock) Close() {
}
// Helper to return a client connected to a mock server
func openConn(t *testing.T, addr string) (*ftpMock, *ServerConn) {
func openConn(t *testing.T, addr string, options ...DialOption) (*ftpMock, *ServerConn) {
mock, err := newFtpMock(t, addr)
if err != nil {
t.Fatal(err)
}
defer mock.Close()
c, err := Dial(mock.Addr())
c, err := DialWithOptions(mock.Addr(), options...)
if err != nil {
t.Fatal(err)
}