]> Cypherpunks.ru repositories - gostls13.git/blob - src/log/slog/internal/buffer/buffer_test.go
log/slog: initial commit
[gostls13.git] / src / log / slog / internal / buffer / buffer_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 "testing"
8
9 func Test(t *testing.T) {
10         b := New()
11         defer b.Free()
12         b.WriteString("hello")
13         b.WriteByte(',')
14         b.Write([]byte(" world"))
15         b.WritePosIntWidth(17, 4)
16
17         got := b.String()
18         want := "hello, world0017"
19         if got != want {
20                 t.Errorf("got %q, want %q", got, want)
21         }
22 }