]> Cypherpunks.ru repositories - gostls13.git/blob - src/log/slog/internal/buffer/norace_test.go
log/slog: initial commit
[gostls13.git] / src / log / slog / internal / buffer / norace_test.go
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 package buffer
6
7 import (
8         "internal/race"
9         "internal/testenv"
10         "testing"
11 )
12
13 func TestAlloc(t *testing.T) {
14         if race.Enabled {
15                 t.Skip("skipping test in race mode")
16         }
17         testenv.SkipIfOptimizationOff(t)
18         got := int(testing.AllocsPerRun(5, func() {
19                 b := New()
20                 defer b.Free()
21                 b.WriteString("not 1K worth of bytes")
22         }))
23         if got != 0 {
24                 t.Errorf("got %d allocs, want 0", got)
25         }
26 }