(t *testing.T)
| 190 | } |
| 191 | |
| 192 | func TestFormatHelpersWithTTYCheck(t *testing.T) { |
| 193 | t.Run("plain output when tty check is false", func(t *testing.T) { |
| 194 | if got := formatInfoMessageWithTTY("processing file", func() bool { return false }); got != "i processing file" { |
| 195 | t.Fatalf("expected unstyled info message, got %q", got) |
| 196 | } |
| 197 | if got := formatSuccessMessageWithTTY("done", func() bool { return false }); got != "✓ done" { |
| 198 | t.Fatalf("expected unstyled success message, got %q", got) |
| 199 | } |
| 200 | if got := formatListItemWithTTY("item", func() bool { return false }); got != " • item" { |
| 201 | t.Fatalf("expected unstyled list item, got %q", got) |
| 202 | } |
| 203 | if got := formatSectionHeaderWithTTY("Header", func() bool { return false }); got != "Header" { |
| 204 | t.Fatalf("expected unstyled header, got %q", got) |
| 205 | } |
| 206 | }) |
| 207 | |
| 208 | t.Run("tty check is consulted", func(t *testing.T) { |
| 209 | calls := 0 |
| 210 | _ = formatInfoMessageWithTTY("x", func() bool { |
| 211 | calls++ |
| 212 | return false |
| 213 | }) |
| 214 | if calls != 1 { |
| 215 | t.Fatalf("expected tty check to be called once, got %d", calls) |
| 216 | } |
| 217 | }) |
| 218 | } |
| 219 | |
| 220 | func TestRenderTable(t *testing.T) { |
| 221 | tests := []struct { |
nothing calls this directly
no test coverage detected