Debian Codegraph @

src/runtime/heap_test.go

raw
1 // Copyright 2023 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package runtime_test
6
7 import (
8 "testing"
9 _ "unsafe"
10 )
11
12 //go:linkname heapObjectsCanMove runtime.heapObjectsCanMove
13 func heapObjectsCanMove() bool
14
15 func TestHeapObjectsCanMove(t *testing.T) {
16 if heapObjectsCanMove() {
17 // If this happens (or this test stops building),
18 // it will break go4.org/unsafe/assume-no-moving-gc.
19 t.Fatalf("heap objects can move!")
20 }
21 }