mirror of https://github.com/pkg/sftp.git
Merge pull request #366 from drakkan/simplify
remove redundant types declaration
This commit is contained in:
commit
f129610309
|
@ -53,34 +53,34 @@ type orderedPair struct {
|
|||
|
||||
// basic test
|
||||
var ttable1 = []pair{
|
||||
pair{fake(0, 0), fake(0, 0)},
|
||||
pair{fake(1, 1), fake(1, 1)},
|
||||
pair{fake(2, 2), fake(2, 2)},
|
||||
pair{fake(3, 3), fake(3, 3)},
|
||||
{fake(0, 0), fake(0, 0)},
|
||||
{fake(1, 1), fake(1, 1)},
|
||||
{fake(2, 2), fake(2, 2)},
|
||||
{fake(3, 3), fake(3, 3)},
|
||||
}
|
||||
|
||||
// outgoing packets out of order
|
||||
var ttable2 = []pair{
|
||||
pair{fake(10, 0), fake(12, 2)},
|
||||
pair{fake(11, 1), fake(11, 1)},
|
||||
pair{fake(12, 2), fake(13, 3)},
|
||||
pair{fake(13, 3), fake(10, 0)},
|
||||
{fake(10, 0), fake(12, 2)},
|
||||
{fake(11, 1), fake(11, 1)},
|
||||
{fake(12, 2), fake(13, 3)},
|
||||
{fake(13, 3), fake(10, 0)},
|
||||
}
|
||||
|
||||
// request ids are not incremental
|
||||
var ttable3 = []pair{
|
||||
pair{fake(7, 0), fake(7, 0)},
|
||||
pair{fake(1, 1), fake(1, 1)},
|
||||
pair{fake(9, 2), fake(3, 3)},
|
||||
pair{fake(3, 3), fake(9, 2)},
|
||||
{fake(7, 0), fake(7, 0)},
|
||||
{fake(1, 1), fake(1, 1)},
|
||||
{fake(9, 2), fake(3, 3)},
|
||||
{fake(3, 3), fake(9, 2)},
|
||||
}
|
||||
|
||||
// request ids are all the same
|
||||
var ttable4 = []pair{
|
||||
pair{fake(1, 0), fake(1, 0)},
|
||||
pair{fake(1, 1), fake(1, 1)},
|
||||
pair{fake(1, 2), fake(1, 3)},
|
||||
pair{fake(1, 3), fake(1, 2)},
|
||||
{fake(1, 0), fake(1, 0)},
|
||||
{fake(1, 1), fake(1, 1)},
|
||||
{fake(1, 2), fake(1, 3)},
|
||||
{fake(1, 3), fake(1, 2)},
|
||||
}
|
||||
|
||||
var tables = [][]pair{ttable1, ttable2, ttable3, ttable4}
|
||||
|
|
|
@ -281,14 +281,14 @@ func TestStatusFromError(t *testing.T) {
|
|||
}
|
||||
}
|
||||
testCases := []test{
|
||||
test{syscall.ENOENT, tpkt(1, sshFxNoSuchFile)},
|
||||
test{&os.PathError{Err: syscall.ENOENT},
|
||||
{syscall.ENOENT, tpkt(1, sshFxNoSuchFile)},
|
||||
{&os.PathError{Err: syscall.ENOENT},
|
||||
tpkt(2, sshFxNoSuchFile)},
|
||||
test{&os.PathError{Err: errors.New("foo")}, tpkt(3, sshFxFailure)},
|
||||
test{ErrSSHFxEOF, tpkt(4, sshFxEOF)},
|
||||
test{ErrSSHFxOpUnsupported, tpkt(5, sshFxOPUnsupported)},
|
||||
test{io.EOF, tpkt(6, sshFxEOF)},
|
||||
test{os.ErrNotExist, tpkt(7, sshFxNoSuchFile)},
|
||||
{&os.PathError{Err: errors.New("foo")}, tpkt(3, sshFxFailure)},
|
||||
{ErrSSHFxEOF, tpkt(4, sshFxEOF)},
|
||||
{ErrSSHFxOpUnsupported, tpkt(5, sshFxOPUnsupported)},
|
||||
{io.EOF, tpkt(6, sshFxEOF)},
|
||||
{os.ErrNotExist, tpkt(7, sshFxNoSuchFile)},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
tc.pkt.StatusError.msg = tc.err.Error()
|
||||
|
|
Loading…
Reference in New Issue