mirror of
https://github.com/gortc/stun.git
synced 2025-09-27 04:45:55 +08:00
17 lines
291 B
Go
17 lines
291 B
Go
package testutil
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
// ShouldNotAllocate fails if f allocates.
|
|
func ShouldNotAllocate(t *testing.T, f func()) {
|
|
if Race {
|
|
t.Skip("skip while running with -race")
|
|
return
|
|
}
|
|
if a := testing.AllocsPerRun(10, f); a > 0 {
|
|
t.Errorf("allocations detected: %f", a)
|
|
}
|
|
}
|