aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/json/encode_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/encoding/json/encode_test.go')
-rw-r--r--src/encoding/json/encode_test.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/encoding/json/encode_test.go b/src/encoding/json/encode_test.go
index df7338c98d..0f194e13d2 100644
--- a/src/encoding/json/encode_test.go
+++ b/src/encoding/json/encode_test.go
@@ -364,9 +364,8 @@ func TestAnonymousFields(t *testing.T) {
want: `{"X":2,"Y":4}`,
}, {
// Exported fields of pointers to embedded structs should have their
- // exported fields be serialized only for exported struct types.
- // Pointers to unexported structs are not allowed since the decoder
- // is unable to allocate a struct for that field
+ // exported fields be serialized regardless of whether the struct types
+ // themselves are exported.
label: "EmbeddedStructPointer",
makeInput: func() interface{} {
type (
@@ -379,7 +378,7 @@ func TestAnonymousFields(t *testing.T) {
)
return S{&s1{1, 2}, &S2{3, 4}}
},
- want: `{"Y":4}`,
+ want: `{"X":2,"Y":4}`,
}, {
// Exported fields on embedded unexported structs at multiple levels
// of nesting should still be serialized.