Add test for DialWithDialFunc
This commit is contained in:
parent
48e53fcac1
commit
a8377c07ac
@ -2,7 +2,9 @@ package ftp
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"net"
|
||||||
"net/textproto"
|
"net/textproto"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
@ -404,3 +406,14 @@ func TestTimeVsftpdFull(t *testing.T) {
|
|||||||
assert.NoError(t, c.Quit())
|
assert.NoError(t, c.Quit())
|
||||||
mock.Wait()
|
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)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user