Files
go-legacy-win7/src/reflect/map_swiss_test.go
Vorapol Rinsatitnon bf266cebe6 Update to go1.24.0
2025-02-14 12:42:07 +07:00

31 lines
860 B
Go

// 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.
//go:build goexperiment.swissmap
package reflect_test
import (
"reflect"
"testing"
)
func testGCBitsMap(t *testing.T) {
// Unlike old maps, we don't manually construct GC data for swiss maps,
// instead using the public reflect API in groupAndSlotOf.
}
// 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())
}
}