testPrintfContains can be used to test Printf methods.
(t *testing.T, logic func(w io.Writer, format string, a any))
| 51 | |
| 52 | // testPrintfContains can be used to test Printf methods. |
| 53 | func testPrintfContains(t *testing.T, logic func(w io.Writer, format string, a any)) { |
| 54 | for _, printable := range printables { |
| 55 | t.Run(fmt.Sprint(printable), func(t *testing.T) { |
| 56 | s := captureStdout(func(w io.Writer) { |
| 57 | logic(w, "Hello, %v!", printable) |
| 58 | }) |
| 59 | testza.AssertContains(t, s, fmt.Sprintf("Hello, %v!", fmt.Sprint(printable))) |
| 60 | }) |
| 61 | pterm.DisableStyling() |
| 62 | t.Run(fmt.Sprint(printable), func(t *testing.T) { |
| 63 | s := captureStdout(func(w io.Writer) { |
| 64 | logic(w, "Hello, %v!", printable) |
| 65 | }) |
| 66 | testza.AssertContains(t, s, fmt.Sprintf("Hello, %v!", fmt.Sprint(printable))) |
| 67 | }) |
| 68 | pterm.EnableStyling() |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | // testPrintflnContains can be used to test Printfln methods. |
| 73 | func testPrintflnContains(t *testing.T, logic func(w io.Writer, format string, a any)) { |
no test coverage detected
searching dependent graphs…