(t *testing.T)
| 17 | } |
| 18 | |
| 19 | func TestSectionPrinterPrintMethods(t *testing.T) { |
| 20 | p := pterm.DefaultSection |
| 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("Printf", func(t *testing.T) { |
| 29 | testPrintfContains(t, func(w io.Writer, format string, a any) { |
| 30 | p.Printf(format, a) |
| 31 | }) |
| 32 | }) |
| 33 | |
| 34 | t.Run("Printfln", func(t *testing.T) { |
| 35 | testPrintflnContains(t, func(w io.Writer, format string, a any) { |
| 36 | p.Printfln(format, a) |
| 37 | }) |
| 38 | }) |
| 39 | |
| 40 | t.Run("Println", func(t *testing.T) { |
| 41 | testPrintlnContains(t, func(w io.Writer, a any) { |
| 42 | p.Println(a) |
| 43 | }) |
| 44 | }) |
| 45 | |
| 46 | t.Run("Sprint", func(t *testing.T) { |
| 47 | testSprintContains(t, func(a any) string { |
| 48 | return p.Sprint(a) |
| 49 | }) |
| 50 | }) |
| 51 | |
| 52 | t.Run("Sprintf", func(t *testing.T) { |
| 53 | testSprintfContains(t, func(format string, a any) string { |
| 54 | return p.Sprintf(format, a) |
| 55 | }) |
| 56 | }) |
| 57 | |
| 58 | t.Run("Sprintfln", func(t *testing.T) { |
| 59 | testSprintflnContains(t, func(format string, a any) string { |
| 60 | return p.Sprintfln(format, a) |
| 61 | }) |
| 62 | }) |
| 63 | |
| 64 | t.Run("Sprintln", func(t *testing.T) { |
| 65 | testSprintlnContains(t, func(a any) string { |
| 66 | return p.Sprintln(a) |
| 67 | }) |
| 68 | }) |
| 69 | |
| 70 | t.Run("PrintOnError", func(t *testing.T) { |
| 71 | result := captureStdout(func(w io.Writer) { |
| 72 | p.PrintOnError(errors.New("hello world")) |
| 73 | }) |
| 74 | testza.AssertContains(t, result, "hello world") |
| 75 | }) |
| 76 |
nothing calls this directly
no test coverage detected
searching dependent graphs…