(t *testing.T)
| 72 | } |
| 73 | |
| 74 | func TestColorPrinterPrintMethods(t *testing.T) { |
| 75 | p := pterm.Color(16) |
| 76 | |
| 77 | t.Run("Print", func(t *testing.T) { |
| 78 | testPrintContains(t, func(w io.Writer, a any) { |
| 79 | p.Print(a) |
| 80 | }) |
| 81 | }) |
| 82 | |
| 83 | t.Run("Printf", func(t *testing.T) { |
| 84 | testPrintfContains(t, func(w io.Writer, format string, a any) { |
| 85 | p.Printf(format, a) |
| 86 | }) |
| 87 | }) |
| 88 | |
| 89 | t.Run("Printfln", func(t *testing.T) { |
| 90 | testPrintflnContains(t, func(w io.Writer, format string, a any) { |
| 91 | p.Printfln(format, a) |
| 92 | }) |
| 93 | }) |
| 94 | |
| 95 | t.Run("Println", func(t *testing.T) { |
| 96 | testPrintlnContains(t, func(w io.Writer, a any) { |
| 97 | p.Println(a) |
| 98 | }) |
| 99 | }) |
| 100 | |
| 101 | t.Run("Sprint", func(t *testing.T) { |
| 102 | testSprintContains(t, func(a any) string { |
| 103 | return p.Sprint(a) |
| 104 | }) |
| 105 | }) |
| 106 | |
| 107 | t.Run("Sprintf", func(t *testing.T) { |
| 108 | testSprintfContains(t, func(format string, a any) string { |
| 109 | return p.Sprintf(format, a) |
| 110 | }) |
| 111 | }) |
| 112 | |
| 113 | t.Run("Sprintfln", func(t *testing.T) { |
| 114 | testSprintflnContains(t, func(format string, a any) string { |
| 115 | return p.Sprintfln(format, a) |
| 116 | }) |
| 117 | }) |
| 118 | |
| 119 | t.Run("Sprintln", func(t *testing.T) { |
| 120 | testSprintlnContains(t, func(a any) string { |
| 121 | return p.Sprintln(a) |
| 122 | }) |
| 123 | }) |
| 124 | |
| 125 | t.Run("PrintOnError", func(t *testing.T) { |
| 126 | result := captureStdout(func(w io.Writer) { |
| 127 | p.PrintOnError(errors.New("hello world")) |
| 128 | }) |
| 129 | testza.AssertContains(t, result, "hello world") |
| 130 | }) |
| 131 |
nothing calls this directly
no test coverage detected
searching dependent graphs…