File size: 655 Bytes
334514d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | // Copyright 2024 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package reflect_test
import (
"reflect"
"testing"
)
// See also runtime_test.TestGroupSizeZero.
func TestGroupSizeZero(t *testing.T) {
st := reflect.TypeFor[struct{}]()
grp := reflect.MapGroupOf(st, st)
// internal/runtime/maps when create pointers to slots, even if slots
// are size 0. We should have reserved an extra word to ensure that
// pointers to the zero-size type at the end of group are valid.
if grp.Size() <= 8 {
t.Errorf("Group size got %d want >8", grp.Size())
}
}
|