MCPcopy
hub / github.com/cli/cli / Test_newIOStreams_colorLabels

Function Test_newIOStreams_colorLabels

internal/ghcmd/cmd_test.go:336–410  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

334}
335
336func Test_newIOStreams_colorLabels(t *testing.T) {
337 tests := []struct {
338 name string
339 config gh.Config
340 colorLabelsEnabled bool
341 env map[string]string
342 }{
343 {
344 name: "default config",
345 colorLabelsEnabled: false,
346 },
347 {
348 name: "config with colorLabels enabled",
349 config: enableColorLabelsConfig(),
350 colorLabelsEnabled: true,
351 },
352 {
353 name: "config with colorLabels disabled",
354 config: disableColorLabelsConfig(),
355 colorLabelsEnabled: false,
356 },
357 {
358 name: "colorLabels enabled via `1` in GH_COLOR_LABELS env var",
359 env: map[string]string{"GH_COLOR_LABELS": "1"},
360 colorLabelsEnabled: true,
361 },
362 {
363 name: "colorLabels enabled via `true` in GH_COLOR_LABELS env var",
364 env: map[string]string{"GH_COLOR_LABELS": "true"},
365 colorLabelsEnabled: true,
366 },
367 {
368 name: "colorLabels enabled via `yes` in GH_COLOR_LABELS env var",
369 env: map[string]string{"GH_COLOR_LABELS": "yes"},
370 colorLabelsEnabled: true,
371 },
372 {
373 name: "colorLabels disable via empty string in GH_COLOR_LABELS env var",
374 env: map[string]string{"GH_COLOR_LABELS": ""},
375 colorLabelsEnabled: false,
376 },
377 {
378 name: "colorLabels disabled via `0` in GH_COLOR_LABELS env var",
379 env: map[string]string{"GH_COLOR_LABELS": "0"},
380 colorLabelsEnabled: false,
381 },
382 {
383 name: "colorLabels disabled via `false` in GH_COLOR_LABELS env var",
384 env: map[string]string{"GH_COLOR_LABELS": "false"},
385 colorLabelsEnabled: false,
386 },
387 {
388 name: "colorLabels disabled via `no` in GH_COLOR_LABELS env var",
389 env: map[string]string{"GH_COLOR_LABELS": "no"},
390 colorLabelsEnabled: false,
391 },
392 }
393 for _, tt := range tests {

Callers

nothing calls this directly

Calls 7

NewBlankConfigFunction · 0.92
enableColorLabelsConfigFunction · 0.85
disableColorLabelsConfigFunction · 0.85
newIOStreamsFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65
ColorLabelsMethod · 0.65

Tested by

no test coverage detected