(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func 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, |