Commit 66477ec8 authored by David Crawshaw's avatar David Crawshaw

reflect: rename, document TestUnaddressableField

Change-Id: I94e0f3e4bccd44a67934ddb4d5fc7da57bb8ac9f
Reviewed-on: https://go-review.googlesource.com/33112Reviewed-by: default avatarRuss Cox <rsc@golang.org>
Reviewed-by: default avatarRob Pike <r@golang.org>
parent 53aec79c
...@@ -5914,8 +5914,13 @@ func TestSwapper(t *testing.T) { ...@@ -5914,8 +5914,13 @@ func TestSwapper(t *testing.T) {
} }
} }
func TestInaccessibleField(t *testing.T) { // TestUnaddressableField tests that the reflect package will not allow
var b Buffer // a type from another package to be used as a named type with an
// unexported field.
//
// This ensures that unexported fields cannot be modified by other packages.
func TestUnaddressableField(t *testing.T) {
var b Buffer // type defined in reflect, a different package
var localBuffer struct { var localBuffer struct {
buf []byte buf []byte
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment