(t *testing.T)
| 76 | } |
| 77 | |
| 78 | func TestTableHeader(t *testing.T) { |
| 79 | reset := "\x1b[0m" |
| 80 | defaultUnderline := "\x1b[0;4;39m" |
| 81 | brightBlackUnderline := "\x1b[0;4;90m" |
| 82 | dimBlackUnderline := "\x1b[0;2;4;37m" |
| 83 | |
| 84 | tests := []struct { |
| 85 | name string |
| 86 | cs *ColorScheme |
| 87 | input string |
| 88 | expected string |
| 89 | }{ |
| 90 | { |
| 91 | name: "when color is disabled, text is not stylized", |
| 92 | cs: &ColorScheme{ |
| 93 | Accessible: true, |
| 94 | Theme: NoTheme, |
| 95 | }, |
| 96 | input: "this should not be stylized", |
| 97 | expected: "this should not be stylized", |
| 98 | }, |
| 99 | { |
| 100 | name: "when 4-bit color is enabled but no theme, 4-bit default color and underline are used", |
| 101 | cs: &ColorScheme{ |
| 102 | Enabled: true, |
| 103 | Accessible: true, |
| 104 | Theme: NoTheme, |
| 105 | }, |
| 106 | input: "this should have no explicit color but underlined", |
| 107 | expected: fmt.Sprintf("%sthis should have no explicit color but underlined%s", defaultUnderline, reset), |
| 108 | }, |
| 109 | { |
| 110 | name: "when 4-bit color is enabled and theme is light, 4-bit dark color and underline are used", |
| 111 | cs: &ColorScheme{ |
| 112 | Enabled: true, |
| 113 | Accessible: true, |
| 114 | Theme: LightTheme, |
| 115 | }, |
| 116 | input: "this should have dark foreground color and underlined", |
| 117 | expected: fmt.Sprintf("%sthis should have dark foreground color and underlined%s", brightBlackUnderline, reset), |
| 118 | }, |
| 119 | { |
| 120 | name: "when 4-bit color is enabled and theme is dark, 4-bit light color and underline are used", |
| 121 | cs: &ColorScheme{ |
| 122 | Enabled: true, |
| 123 | Accessible: true, |
| 124 | Theme: DarkTheme, |
| 125 | }, |
| 126 | input: "this should have light foreground color and underlined", |
| 127 | expected: fmt.Sprintf("%sthis should have light foreground color and underlined%s", dimBlackUnderline, reset), |
| 128 | }, |
| 129 | { |
| 130 | name: "when 8-bit color is enabled but no theme, 4-bit default color and underline are used", |
| 131 | cs: &ColorScheme{ |
| 132 | Enabled: true, |
| 133 | EightBitColor: true, |
| 134 | Accessible: true, |
| 135 | Theme: NoTheme, |
nothing calls this directly
no test coverage detected