Add test for DialWithDialFunc

This commit is contained in:
Julien Laffaye 2022-03-08 19:06:48 -05:00
parent 48e53fcac1
commit a8377c07ac

View File

@ -2,7 +2,9 @@ package ftp
import (
"bytes"
"fmt"
"io/ioutil"
"net"
"net/textproto"
"strings"
"testing"
@ -404,3 +406,14 @@ func TestTimeVsftpdFull(t *testing.T) {
assert.NoError(t, c.Quit())
mock.Wait()
}
func TestDialWithDialFunc(t *testing.T) {
dialErr := fmt.Errorf("this is proof that dial function was called")
f := func(network, address string) (net.Conn, error) {
return nil, dialErr
}
_, err := Dial("bogus-address", DialWithDialFunc(f))
assert.Equal(t, dialErr, err)
}