-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
time_test.go
60 lines (51 loc) · 1.29 KB
/
time_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
55
56
57
58
59
60
package regex2json
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
var testLayouts = map[string]string{ //nolint:gochecknoglobals
"ANSIC": time.ANSIC,
"UnixDate": time.UnixDate,
"RubyDate": time.RubyDate,
"RFC822": time.RFC822,
"RFC822Z": time.RFC822Z,
"RFC850": time.RFC850,
"RFC1123": time.RFC1123,
"RFC1123Z": time.RFC1123Z,
"RFC3339": time.RFC3339,
"RFC3339Nano": time.RFC3339Nano,
"Kitchen": time.Kitchen,
"Stamp": time.Stamp,
"StampMilli": time.StampMilli,
"StampMicro": time.StampMicro,
"StampNano": time.StampNano,
"DateTime": time.DateTime,
"DateOnly": time.DateOnly,
"TimeOnly": time.TimeOnly,
}
func TestLayoutsWithoutYear(t *testing.T) {
t.Parallel()
assert.Equal(t, map[string]bool{
"Kitchen": true,
"Stamp": true,
"StampMicro": true,
"StampMilli": true,
"StampNano": true,
"TimeOnly": true,
}, layoutsWithoutYear(testLayouts))
}
func TestLayoutsWithoutMonth(t *testing.T) {
t.Parallel()
assert.Equal(t, map[string]bool{
"Kitchen": true,
"TimeOnly": true,
}, layoutsWithoutMonth(testLayouts))
}
func TestLayoutsWithoutDay(t *testing.T) {
t.Parallel()
assert.Equal(t, map[string]bool{
"Kitchen": true,
"TimeOnly": true,
}, layoutsWithoutDay(testLayouts))
}