MCPcopy Create free account
hub / github.com/cli/cli / TestLabel

Function TestLabel

pkg/iostreams/color_test.go:10–76  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestLabel(t *testing.T) {
11 tests := []struct {
12 name string
13 hex string
14 text string
15 wants string
16 cs *ColorScheme
17 }{
18 {
19 name: "truecolor",
20 hex: "fc0303",
21 text: "red",
22 wants: "\033[38;2;252;3;3mred\033[0m",
23 cs: &ColorScheme{
24 Enabled: true,
25 EightBitColor: true,
26 TrueColor: true,
27 ColorLabels: true,
28 },
29 },
30 {
31 name: "no truecolor",
32 hex: "fc0303",
33 text: "red",
34 wants: "red",
35 cs: &ColorScheme{
36 Enabled: true,
37 EightBitColor: true,
38 ColorLabels: true,
39 },
40 },
41 {
42 name: "no color",
43 hex: "fc0303",
44 text: "red",
45 wants: "red",
46 cs: &ColorScheme{
47 ColorLabels: true,
48 },
49 },
50 {
51 name: "invalid hex",
52 hex: "fc0",
53 text: "red",
54 wants: "red",
55 cs: &ColorScheme{
56 ColorLabels: true,
57 },
58 },
59 {
60 name: "no color labels",
61 hex: "fc0303",
62 text: "red",
63 wants: "red",
64 cs: &ColorScheme{
65 Enabled: true,
66 EightBitColor: true,
67 ColorLabels: true,

Callers

nothing calls this directly

Calls 2

EqualMethod · 0.80
LabelMethod · 0.45

Tested by

no test coverage detected