From 66477ec8307e18f751996d92ac8741596a23615a Mon Sep 17 00:00:00 2001 From: David Crawshaw Date: Thu, 10 Nov 2016 19:02:07 -0500 Subject: [PATCH] reflect: rename, document TestUnaddressableField Change-Id: I94e0f3e4bccd44a67934ddb4d5fc7da57bb8ac9f Reviewed-on: https://go-review.googlesource.com/33112 Reviewed-by: Russ Cox Reviewed-by: Rob Pike --- src/reflect/all_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/reflect/all_test.go b/src/reflect/all_test.go index 4c11609218..7dfdfd8709 100644 --- a/src/reflect/all_test.go +++ b/src/reflect/all_test.go @@ -5914,8 +5914,13 @@ func TestSwapper(t *testing.T) { } } -func TestInaccessibleField(t *testing.T) { - var b Buffer +// TestUnaddressableField tests that the reflect package will not allow +// 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 { buf []byte }