Rename epSetup to epCfg.
This commit is contained in:
@@ -32,7 +32,7 @@ func (t *fakeTransfer) wait() (int, error) { return t.ret, t.err }
|
|||||||
func (*fakeTransfer) free() error { return nil }
|
func (*fakeTransfer) free() error { return nil }
|
||||||
|
|
||||||
func TestEndpoint(t *testing.T) {
|
func TestEndpoint(t *testing.T) {
|
||||||
for _, epSetup := range []struct {
|
for _, epCfg := range []struct {
|
||||||
method string
|
method string
|
||||||
InterfaceSetup
|
InterfaceSetup
|
||||||
EndpointInfo
|
EndpointInfo
|
||||||
@@ -40,7 +40,7 @@ func TestEndpoint(t *testing.T) {
|
|||||||
{"Read", testBulkInSetup, testBulkInEP},
|
{"Read", testBulkInSetup, testBulkInEP},
|
||||||
{"Write", testIsoOutSetup, testIsoOutEP},
|
{"Write", testIsoOutSetup, testIsoOutEP},
|
||||||
} {
|
} {
|
||||||
t.Run(epSetup.method, func(t *testing.T) {
|
t.Run(epCfg.method, func(t *testing.T) {
|
||||||
for _, tc := range []struct {
|
for _, tc := range []struct {
|
||||||
buf []byte
|
buf []byte
|
||||||
ret int
|
ret int
|
||||||
@@ -53,15 +53,15 @@ func TestEndpoint(t *testing.T) {
|
|||||||
{buf: make([]byte, 128), ret: 10, err: errors.New("some error"), want: 10, wantErr: true},
|
{buf: make([]byte, 128), ret: 10, err: errors.New("some error"), want: 10, wantErr: true},
|
||||||
} {
|
} {
|
||||||
ep := &endpoint{
|
ep := &endpoint{
|
||||||
InterfaceSetup: epSetup.InterfaceSetup,
|
InterfaceSetup: epCfg.InterfaceSetup,
|
||||||
EndpointInfo: epSetup.EndpointInfo,
|
EndpointInfo: epCfg.EndpointInfo,
|
||||||
newUSBTransfer: func(buf []byte, timeout time.Duration) (transferIntf, error) {
|
newUSBTransfer: func(buf []byte, timeout time.Duration) (transferIntf, error) {
|
||||||
return &fakeTransfer{buf: buf, ret: tc.ret, err: tc.err}, nil
|
return &fakeTransfer{buf: buf, ret: tc.ret, err: tc.err}, nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
op, ok := reflect.TypeOf(ep).MethodByName(epSetup.method)
|
op, ok := reflect.TypeOf(ep).MethodByName(epCfg.method)
|
||||||
if !ok {
|
if !ok {
|
||||||
t.Fatalf("method %s not found in endpoint", epSetup.method)
|
t.Fatalf("method %s not found in endpoint struct", epCfg.method)
|
||||||
}
|
}
|
||||||
opv := op.Func.Interface().(func(*endpoint, []byte) (int, error))
|
opv := op.Func.Interface().(func(*endpoint, []byte) (int, error))
|
||||||
got, err := opv(ep, tc.buf)
|
got, err := opv(ep, tc.buf)
|
||||||
|
Reference in New Issue
Block a user