MCPcopy
hub / github.com/pterm/pterm / TestParagraphPrinterPrintMethods

Function TestParagraphPrinterPrintMethods

paragraph_printer_test.go:19–107  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

17}
18
19func TestParagraphPrinterPrintMethods(t *testing.T) {
20 p := pterm.DefaultParagraph
21
22 t.Run("Print", func(t *testing.T) {
23 testPrintContains(t, func(w io.Writer, a any) {
24 p.Print(a)
25 })
26 })
27
28 t.Run("PrintWithLongText", func(t *testing.T) {
29 proxyToDevNull()
30 testza.AssertNotZero(t, p.Print("This is a longer text to test the paragraph printer. I don't know when this text will be long enough so I will just write until I get the feeling that it's enough. Maybe about now."))
31 })
32
33 t.Run("PrintWithoutText", func(t *testing.T) {
34 proxyToDevNull()
35 testza.AssertNotZero(t, p.Print(""))
36 })
37
38 t.Run("Printf", func(t *testing.T) {
39 testPrintfContains(t, func(w io.Writer, format string, a any) {
40 p.Printf(format, a)
41 })
42 })
43
44 t.Run("Printfln", func(t *testing.T) {
45 testPrintflnContains(t, func(w io.Writer, format string, a any) {
46 p.Printfln(format, a)
47 })
48 })
49
50 t.Run("Println", func(t *testing.T) {
51 testPrintlnContains(t, func(w io.Writer, a any) {
52 p.Println(a)
53 })
54 })
55
56 t.Run("Sprint", func(t *testing.T) {
57 testSprintContains(t, func(a any) string {
58 return p.Sprint(a)
59 })
60 })
61
62 t.Run("Sprintf", func(t *testing.T) {
63 testSprintfContains(t, func(format string, a any) string {
64 return p.Sprintf(format, a)
65 })
66 })
67
68 t.Run("Sprintfln", func(t *testing.T) {
69 testSprintflnContains(t, func(format string, a any) string {
70 return p.Sprintfln(format, a)
71 })
72 })
73
74 t.Run("Sprintln", func(t *testing.T) {
75 testSprintlnContains(t, func(a any) string {
76 return p.Sprintln(a)

Callers

nothing calls this directly

Calls 15

testPrintContainsFunction · 0.85
proxyToDevNullFunction · 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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…