MCPcopy
hub / github.com/pterm/pterm / TestCenterPrinterPrintMethods

Function TestCenterPrinterPrintMethods

center_printer_test.go:22–100  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

20}
21
22func TestCenterPrinterPrintMethods(t *testing.T) {
23 p := pterm.DefaultCenter
24
25 t.Run("Print", func(t *testing.T) {
26 testPrintContains(t, func(w io.Writer, a any) {
27 p.Print(a)
28 })
29 })
30
31 t.Run("Printf", func(t *testing.T) {
32 testPrintfContains(t, func(w io.Writer, format string, a any) {
33 p.Printf(format, a)
34 })
35 })
36
37 t.Run("Printfln", func(t *testing.T) {
38 testPrintflnContains(t, func(w io.Writer, format string, a any) {
39 p.Printfln(format, a)
40 })
41 })
42
43 t.Run("Println", func(t *testing.T) {
44 testPrintlnContains(t, func(w io.Writer, a any) {
45 p.Println(a)
46 })
47 })
48
49 t.Run("Sprint", func(t *testing.T) {
50 testSprintContains(t, func(a any) string {
51 return p.Sprint(a)
52 })
53 })
54
55 t.Run("Sprintf", func(t *testing.T) {
56 testSprintfContains(t, func(format string, a any) string {
57 return p.Sprintf(format, a)
58 })
59 })
60
61 t.Run("Sprintfln", func(t *testing.T) {
62 testSprintflnContains(t, func(format string, a any) string {
63 return p.Sprintfln(format, a)
64 })
65 })
66
67 t.Run("Sprintln", func(t *testing.T) {
68 testSprintlnContains(t, func(a any) string {
69 return p.Sprintln(a)
70 })
71 })
72
73 t.Run("PrintOnError", func(t *testing.T) {
74 result := captureStdout(func(w io.Writer) {
75 p.PrintOnError(errors.New("hello world"))
76 })
77 testza.AssertContains(t, result, "hello world")
78 })
79

Callers

nothing calls this directly

Calls 15

testPrintContainsFunction · 0.85
testPrintfContainsFunction · 0.85
testPrintflnContainsFunction · 0.85
testPrintlnContainsFunction · 0.85
testSprintContainsFunction · 0.85
testSprintfContainsFunction · 0.85
testSprintflnContainsFunction · 0.85
testSprintlnContainsFunction · 0.85
captureStdoutFunction · 0.85
PrintMethod · 0.65
PrintfMethod · 0.65
PrintflnMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…