...

Source file src/golang.org/x/exp/slog/norace_test.go

Documentation: golang.org/x/exp/slog

     1  // Copyright 2022 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  //go:build !race
     6  
     7  package slog
     8  
     9  import "testing"
    10  
    11  func wantAllocs(t *testing.T, want int, f func()) {
    12  	t.Helper()
    13  	got := int(testing.AllocsPerRun(5, f))
    14  	if got != want {
    15  		t.Errorf("got %d allocs, want %d", got, want)
    16  	}
    17  }
    18  

View as plain text