diff options
author | Ian Lance Taylor <iant@golang.org> | 2020-10-01 14:55:11 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2020-10-01 22:23:53 +0000 |
commit | 41df0e22184a0fcfb1e67e994c993239e9c2efc7 (patch) | |
tree | f80c3e98947182c630b77dbf73ffed892c2dd2ef /src/reflect | |
parent | 507a88c39bb1089b9d44facb7dd3449a9b5a3e10 (diff) | |
download | go-41df0e22184a0fcfb1e67e994c993239e9c2efc7.tar.gz go-41df0e22184a0fcfb1e67e994c993239e9c2efc7.zip |
reflect: add test for variadic reflect.Type.Method
For #41737
Change-Id: Id065880dd7da54dec1b45662c202aeb7f8397c60
Reviewed-on: https://go-review.googlesource.com/c/go/+/258819
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/reflect')
-rw-r--r-- | src/reflect/all_test.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/reflect/all_test.go b/src/reflect/all_test.go index abdfe41908..ec87ec0c8a 100644 --- a/src/reflect/all_test.go +++ b/src/reflect/all_test.go @@ -2405,8 +2405,14 @@ func TestVariadicMethodValue(t *testing.T) { points := []Point{{20, 21}, {22, 23}, {24, 25}} want := int64(p.TotalDist(points[0], points[1], points[2])) + // Variadic method of type. + tfunc := TypeOf((func(Point, ...Point) int)(nil)) + if tt := TypeOf(p).Method(4).Type; tt != tfunc { + t.Errorf("Variadic Method Type from TypeOf is %s; want %s", tt, tfunc) + } + // Curried method of value. - tfunc := TypeOf((func(...Point) int)(nil)) + tfunc = TypeOf((func(...Point) int)(nil)) v := ValueOf(p).Method(4) if tt := v.Type(); tt != tfunc { t.Errorf("Variadic Method Type is %s; want %s", tt, tfunc) |