(t *testing.T)
| 277 | } |
| 278 | |
| 279 | func TestColorSelection(t *testing.T) { |
| 280 | // Test that selectNamespaceLabel returns consistent colors for the same namespace |
| 281 | color1 := selectNamespaceLabel("test:namespace") |
| 282 | color2 := selectNamespaceLabel("test:namespace") |
| 283 | if color1 != color2 { |
| 284 | t.Errorf("selectNamespaceLabel should return same color for same namespace") |
| 285 | } |
| 286 | if color1 == "" { |
| 287 | t.Error("selectNamespaceLabel should return non-empty namespace label") |
| 288 | } |
| 289 | if !strings.Contains(color1, "test:namespace") { |
| 290 | t.Errorf("selectNamespaceLabel should include namespace text, got %q", color1) |
| 291 | } |
| 292 | if !strings.Contains(color1, "\x1b[") { |
| 293 | t.Errorf("selectNamespaceLabel should include ANSI styling when colors are enabled, got %q", color1) |
| 294 | } |
| 295 | |
| 296 | // When colors are disabled, selectNamespaceLabel should return plain namespace text. |
| 297 | origDebugColors := debugColors |
| 298 | debugColors = false |
| 299 | t.Cleanup(func() { debugColors = origDebugColors }) |
| 300 | if got := selectNamespaceLabel("plain:namespace"); got != "plain:namespace" { |
| 301 | t.Errorf("selectNamespaceLabel should return plain namespace when debugColors=false, got %q", got) |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | func TestNoColorEnvironment(t *testing.T) { |
| 306 | // Save original values |
nothing calls this directly
no test coverage detected