Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for TestPointer (0.11 sec)

  1. src/internal/weak/pointer_test.go

    	"testing"
    )
    
    type T struct {
    	// N.B. This must contain a pointer, otherwise the weak handle might get placed
    	// in a tiny block making the tests in this package flaky.
    	t *T
    	a int
    }
    
    func TestPointer(t *testing.T) {
    	bt := new(T)
    	wt := weak.Make(bt)
    	if st := wt.Strong(); st != bt {
    		t.Fatalf("weak pointer is not the same as strong pointer: %p vs. %p", st, bt)
    	}
    	// bt is still referenced.
    	runtime.GC()
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 18 21:25:11 UTC 2024
    - 3.1K bytes
    - Viewed (0)
Back to top