(t *testing.T)
| 21 | } |
| 22 | |
| 23 | func TestPrefixPrinterPrintMethods(t *testing.T) { |
| 24 | for _, p := range prefixPrinters { |
| 25 | t.Run("Print", func(t *testing.T) { |
| 26 | testPrintContains(t, func(w io.Writer, a any) { |
| 27 | p.WithWriter(w).Print(a) |
| 28 | }) |
| 29 | }) |
| 30 | |
| 31 | t.Run("PrintWithScope", func(t *testing.T) { |
| 32 | testPrintContains(t, func(w io.Writer, a any) { |
| 33 | p2 := p.WithScope(pterm.Scope{ |
| 34 | Text: "test", |
| 35 | Style: pterm.NewStyle(pterm.FgRed, pterm.BgBlue, pterm.Bold), |
| 36 | }) |
| 37 | p2.WithWriter(w).Print(a) |
| 38 | }) |
| 39 | }) |
| 40 | |
| 41 | t.Run("PrintWithShowLineNumber", func(t *testing.T) { |
| 42 | testPrintContains(t, func(w io.Writer, a any) { |
| 43 | p2 := p.WithShowLineNumber().WithWriter(w) |
| 44 | p2.Print(a) |
| 45 | }) |
| 46 | }) |
| 47 | |
| 48 | t.Run("PrintWithMultipleLines", func(t *testing.T) { |
| 49 | p2 := p.WithScope(pterm.Scope{ |
| 50 | Text: "test", |
| 51 | Style: pterm.NewStyle(pterm.FgRed, pterm.BgBlue, pterm.Bold), |
| 52 | }) |
| 53 | p2.Print("This text\nhas\nmultiple\nlines") |
| 54 | }) |
| 55 | |
| 56 | t.Run("Printf", func(t *testing.T) { |
| 57 | testPrintfContains(t, func(w io.Writer, format string, a any) { |
| 58 | p.WithWriter(w).Printf(format, a) |
| 59 | }) |
| 60 | }) |
| 61 | |
| 62 | t.Run("Printfln", func(t *testing.T) { |
| 63 | testPrintflnContains(t, func(w io.Writer, format string, a any) { |
| 64 | p.WithWriter(w).Printfln(format, a) |
| 65 | }) |
| 66 | }) |
| 67 | |
| 68 | t.Run("Println", func(t *testing.T) { |
| 69 | testPrintlnContains(t, func(w io.Writer, a any) { |
| 70 | p.WithWriter(w).Println(a) |
| 71 | }) |
| 72 | }) |
| 73 | |
| 74 | t.Run("Sprint", func(t *testing.T) { |
| 75 | testSprintContains(t, func(a any) string { |
| 76 | return p.Sprint(a) |
| 77 | }) |
| 78 | }) |
| 79 | |
| 80 | t.Run("Sprintf", func(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…