mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
reflect: add test that method values have the same code pointers
Updates #40592 Change-Id: I16252dd57aceb5c49ddc11d8c12c601ca87ca902 Reviewed-on: https://go-review.googlesource.com/c/go/+/356252 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
42515418a9
commit
543a513304
1 changed files with 5 additions and 0 deletions
|
|
@ -2511,6 +2511,11 @@ func TestMethodValue(t *testing.T) {
|
|||
p := Point{3, 4}
|
||||
var i int64
|
||||
|
||||
// Check that method value have the same underlying code pointers.
|
||||
if p1, p2 := ValueOf(Point{1, 1}).Method(1), ValueOf(Point{2, 2}).Method(1); p1.Pointer() != p2.Pointer() {
|
||||
t.Errorf("methodValueCall mismatched: %v - %v", p1, p2)
|
||||
}
|
||||
|
||||
// Curried method of value.
|
||||
tfunc := TypeOf((func(int) int)(nil))
|
||||
v := ValueOf(p).Method(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue