...

Source file src/golang.org/x/exp/slog/internal/buffer/buffer_test.go

Documentation: golang.org/x/exp/slog/internal/buffer

     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  }
    23  

View as plain text