mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
reflect: test that method name offset is valid
Bug fix went in CL 21396, this is a matching test. Fixes #15343 Change-Id: I3670145c7cac45cb4fb3121ffc039cfb7fa7c87a Reviewed-on: https://go-review.googlesource.com/22171 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
411a0adc9b
commit
2e2df78ae9
1 changed files with 11 additions and 0 deletions
|
|
@ -5686,3 +5686,14 @@ func TestNameBytesAreAligned(t *testing.T) {
|
||||||
t.Errorf("reflect.name.bytes pointer is not aligned: %x", v)
|
t.Errorf("reflect.name.bytes pointer is not aligned: %x", v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestMethodPkgPathReadable(t *testing.T) {
|
||||||
|
// Reading the Method type for an unexported method triggers an
|
||||||
|
// offset resolution via p.name.pkgPath(). Make sure it uses a
|
||||||
|
// valid base pointer for the offset.
|
||||||
|
v := ValueOf(embed{})
|
||||||
|
m := v.Type().Method(0)
|
||||||
|
if m.PkgPath != "reflect" {
|
||||||
|
t.Errorf(`PkgPath=%q, want "reflect"`, m.PkgPath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue