- Sort Score
- Result 10 results
- Languages All
Results 1 - 1 of 1 for TestOnceFunc (0.12 sec)
-
src/sync/oncefunc_test.go
import ( "bytes" "math" "runtime" "runtime/debug" "sync" "sync/atomic" "testing" _ "unsafe" ) // We assume that the Once.Do tests have already covered parallelism. func TestOnceFunc(t *testing.T) { calls := 0 f := sync.OnceFunc(func() { calls++ }) allocs := testing.AllocsPerRun(10, f) if calls != 1 { t.Errorf("want calls==1, got %d", calls) } if allocs != 0 {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Nov 21 17:31:33 UTC 2023 - 6.9K bytes - Viewed (0)