-
Notifications
You must be signed in to change notification settings - Fork 0
/
columncolor_test.go
54 lines (49 loc) · 988 Bytes
/
columncolor_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package main
import (
"regexp"
"testing"
)
func TestColumnColorValue(t *testing.T) {
var tests = []struct {
inColumn ColumnColor
outValue string
}{
{
inColumn: ColumnColor{},
outValue: "^[A-Z][a-z]+$",
},
}
for _, test := range tests {
actual, _ := test.inColumn.Value(nil)
matched, _ := regexp.MatchString(test.outValue, actual)
if !matched {
t.Fatalf("Expected: %v\nActual: %v", test.outValue, actual)
}
}
}
func TestColumnColorHexValue(t *testing.T) {
var tests = []struct {
inColumn ColumnColorHex
outValue string
}{
{
inColumn: ColumnColorHex{},
outValue: "^[0-9a-z]{6}$",
},
{
inColumn: ColumnColorHex{
payload: ColumnColorHexPayload{
Short: true,
},
},
outValue: "^[0-9a-z]{3}$",
},
}
for _, test := range tests {
actual, _ := test.inColumn.Value(nil)
matched, _ := regexp.MatchString(test.outValue, actual)
if !matched {
t.Fatalf("Expected: %v\nActual: %v", test.outValue, actual)
}
}
}