(t *testing.T)
| 126 | } |
| 127 | |
| 128 | func TestPrintfln(t *testing.T) { |
| 129 | t.Run("enabled output", func(t *testing.T) { |
| 130 | pterm.Output = true |
| 131 | for _, randomString := range internal.RandomStrings { |
| 132 | out := captureStdout(func(w io.Writer) { |
| 133 | pterm.Printfln("%s", randomString) |
| 134 | }) |
| 135 | testza.AssertEqual(t, randomString+"\n", out) |
| 136 | } |
| 137 | out := captureStdout(func(w io.Writer) { |
| 138 | pterm.Printfln("Hello, %s!", "World") |
| 139 | }) |
| 140 | testza.AssertEqual(t, "Hello, World!\n", out) |
| 141 | }) |
| 142 | |
| 143 | t.Run("disabled output", func(t *testing.T) { |
| 144 | pterm.Output = false |
| 145 | for _, randomString := range internal.RandomStrings { |
| 146 | out := captureStdout(func(w io.Writer) { |
| 147 | pterm.Printfln("%s", randomString) |
| 148 | }) |
| 149 | testza.AssertEqual(t, "", out) |
| 150 | } |
| 151 | out := captureStdout(func(w io.Writer) { |
| 152 | pterm.Printfln("Hello, %s!", "World") |
| 153 | }) |
| 154 | testza.AssertEqual(t, "", out) |
| 155 | pterm.Output = true |
| 156 | }) |
| 157 | } |
| 158 | |
| 159 | func TestFprint(t *testing.T) { |
| 160 | t.Run("enabled output", func(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…