MCPcopy Index your code
hub / github.com/pterm/pterm / TestMultiPrinterGetString

Function TestMultiPrinterGetString

multi_live_printer_test.go:8–51  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

6)
7
8func TestMultiPrinterGetString(t *testing.T) {
9 t.Parallel()
10
11 for _, test := range []struct {
12 name string
13 buf string
14 want string
15 }{
16 {
17 name: "test1",
18 buf: "test\rtest2\rtest3",
19 want: "test3\n",
20 },
21 {
22 name: "test2",
23 buf: "\r\n",
24 want: "",
25 },
26 {
27 name: "test3",
28 buf: "test",
29 want: "test\n",
30 },
31 {
32 name: "test4",
33 buf: "",
34 want: "",
35 },
36 } {
37 test := test // pin for pre-go1.22 versions
38 t.Run(test.name, func(t *testing.T) {
39 t.Parallel()
40
41 p := DefaultMultiPrinter
42 p.buffers = []*bytes.Buffer{
43 bytes.NewBufferString(test.buf),
44 }
45
46 if test.want != p.getString() {
47 t.Errorf("got %v, want %v", p.getString(), test.want)
48 }
49 })
50 }
51}

Callers

nothing calls this directly

Calls 1

getStringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…