Add test for DialWithDialFunc
This commit is contained in:
		
							parent
							
								
									48e53fcac1
								
							
						
					
					
						commit
						a8377c07ac
					
				@ -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)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user