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