@@ -36,9 +36,10 @@ import (
36
36
37
37
type TestService struct {
38
38
MethodOne func (context.Context , int , bool , * interface {}) error
39
- MethodTwo func ([]interface {}, * interface {} ) error
39
+ MethodTwo func ([]interface {}) error
40
40
MethodThree func (int , bool ) (interface {}, error )
41
41
MethodFour func (int , bool ) (* interface {}, error ) `dubbo:"methodFour"`
42
+ MethodFive func () error
42
43
Echo func (interface {}, * interface {}) error
43
44
}
44
45
@@ -64,19 +65,25 @@ func TestProxy_Implement(t *testing.T) {
64
65
p := NewProxy (invoker , nil , map [string ]string {constant .ASYNC_KEY : "false" })
65
66
s := & TestService {}
66
67
p .Implement (s )
68
+
67
69
err := p .Get ().(* TestService ).MethodOne (nil , 0 , false , nil )
68
70
assert .NoError (t , err )
69
- err = p .Get ().(* TestService ).MethodTwo (nil , nil )
71
+
72
+ err = p .Get ().(* TestService ).MethodTwo (nil )
70
73
assert .NoError (t , err )
71
74
ret , err := p .Get ().(* TestService ).MethodThree (0 , false )
72
75
assert .NoError (t , err )
73
76
assert .Nil (t , ret ) // ret is nil, because it doesn't be injection yet
77
+
74
78
ret2 , err := p .Get ().(* TestService ).MethodFour (0 , false )
75
79
assert .NoError (t , err )
76
80
assert .Equal (t , "*interface {}" , reflect .TypeOf (ret2 ).String ())
77
81
err = p .Get ().(* TestService ).Echo (nil , nil )
78
82
assert .NoError (t , err )
79
83
84
+ err = p .Get ().(* TestService ).MethodFive ()
85
+ assert .NoError (t , err )
86
+
80
87
// inherit & lowercase
81
88
p .rpc = nil
82
89
type S1 struct {
@@ -108,24 +115,14 @@ func TestProxy_Implement(t *testing.T) {
108
115
p .Implement (s2 )
109
116
assert .Nil (t , s2 .MethodOne )
110
117
111
- // reply type
118
+ // returns type
112
119
p .rpc = nil
113
120
type S3 struct {
114
121
TestService
115
- MethodOne func (context.Context , []interface {}, struct {}) error
122
+ MethodOne func (context.Context , []interface {}, * struct {}) interface {}
116
123
}
117
124
s3 := & S3 {TestService : * s }
118
125
p .Implement (s3 )
119
126
assert .Nil (t , s3 .MethodOne )
120
127
121
- // returns type
122
- p .rpc = nil
123
- type S4 struct {
124
- TestService
125
- MethodOne func (context.Context , []interface {}, * struct {}) interface {}
126
- }
127
- s4 := & S4 {TestService : * s }
128
- p .Implement (s4 )
129
- assert .Nil (t , s4 .MethodOne )
130
-
131
128
}
0 commit comments