-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
date_test.go
67 lines (56 loc) · 1.71 KB
/
date_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
61
62
63
64
65
66
67
package gouse
import (
"testing"
"time"
)
func TestISODate(t *testing.T) {
now := time.Now()
if ISODate() != now.Format("2006-01-02T15:04:05.999Z") {
t.Error("ISO() should return today's date in ISO format")
}
}
func TestNormalDate(t *testing.T) {
if NormalDate() != time.Now().Format("01/02/2006") {
t.Error("ShortNormal() should return today's date in ShortNormal format")
}
}
func TestReverseDate(t *testing.T) {
if ReverseDate() != time.Now().Format("2006/01/02") {
t.Error("ShortReverse() should return today's date in ShortReverse format")
}
}
func TestDashDate(t *testing.T) {
if DashDate() != time.Now().Format("2006-01-02") {
t.Error("ShortDash() should return today's date in ShortDash format")
}
}
func TestDotDash(t *testing.T) {
if DotDate() != time.Now().Format("2006.01.02") {
t.Error("ShortDot() should return today's date in ShortDot format")
}
}
func TestUnderlineDate(t *testing.T) {
if UnderlineDate() != time.Now().Format("2006_01_02") {
t.Error("ShortUnderscore() should return today's date in ShortUnderscore format")
}
}
func TestSpaceDate(t *testing.T) {
if SpaceDate() != time.Now().Format("2006 01 02") {
t.Error("ShortSpace() should return today's date in ShortSpace format")
}
}
func TestMonthDate(t *testing.T) {
if MonthDate() != time.Now().Format("01/2006") {
t.Error("ShortMonth() should return today's date in ShortMonth format")
}
}
func TestLongDate(t *testing.T) {
if LongDate() != time.Now().Format("Monday, January 2, 2006") {
t.Error("Long() should return today's date in Long format")
}
}
func TestUTCDate(t *testing.T) {
if UTCDate() != time.Now().Format("Jan 2, 2006 at 3:04pm (MST)") {
t.Error("UTC() should return today's date in UTC format")
}
}