-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgerman_test.go
125 lines (119 loc) · 3.03 KB
/
german_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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
package zyt_test
import (
"testing"
"time"
"github.com/hansmi/zyt"
"github.com/hansmi/zyt/pkg/zyttesting"
)
func TestGerman(t *testing.T) {
test := zyttesting.LocaleTest{
ParseInLocation: []zyttesting.ParseInLocationTest{
{
Name: "rfc3339",
Layout: time.RFC3339,
Value: "2023-02-03T04:05:06+01:00",
Want: time.Date(2023, time.February, 3, 3, 5, 6, 0, time.UTC),
},
{
Name: "rfc822",
Layout: time.RFC822,
Value: "02 Mrz 23 15:04 UTC",
Want: time.Date(2023, time.March, 2, 15, 4, 0, 0, time.UTC),
},
{
Name: "long",
Layout: "2. January 2006",
Value: "12. Dezember 2000",
Want: time.Date(2000, time.December, 12, 0, 0, 0, 0, time.UTC),
},
{
Name: "Austrian",
Layout: "2. January 2006",
Value: "15. Jänner 2010",
Want: time.Date(2010, time.January, 15, 0, 0, 0, 0, time.UTC),
},
{
Name: "Monday",
Layout: "Monday, 2.1.2006",
Value: "Montag, 1.4.2020",
Want: time.Date(2020, time.April, 1, 0, 0, 0, 0, time.UTC),
},
{
Name: "Monday short",
Layout: "Mon, 2.1.2006 PM",
Value: "Mo., 1.4.2020 nachm.",
Want: time.Date(2020, time.April, 1, 12, 0, 0, 0, time.UTC),
},
{
Name: "March without umlaut",
Layout: "2. January 2006",
Value: "12. Marz 2000",
Want: time.Date(2000, time.March, 12, 0, 0, 0, 0, time.UTC),
},
},
Format: []zyttesting.FormatTest{
{
Name: "rfc3339",
Layout: time.RFC3339,
Value: time.Date(2023, time.February, 3, 3, 5, 6, 0, time.UTC),
Want: "2023-02-03T03:05:06Z",
},
{
Name: "rfc822",
Layout: time.RFC822,
Value: time.Date(2023, time.March, 2, 15, 4, 0, 0, time.UTC),
Want: "02 Mär. 23 15:04 UTC",
},
{
Name: "long",
Layout: "2. January 2006",
Value: time.Date(2000, time.December, 12, 0, 0, 0, 0, time.UTC),
Want: "12. Dezember 2000",
},
{
Name: "day",
Layout: "Mon, 2. January 2006",
Value: time.Date(2000, time.December, 12, 0, 0, 0, 0, time.UTC),
Want: "Di, 12. Dezember 2000",
},
{
Name: "am",
Layout: time.Kitchen,
Value: time.Date(2000, time.January, 1, 1, 2, 3, 0, time.UTC),
Want: "1:02vorm.",
},
{
Name: "january",
Layout: "2. January 2006",
Value: time.Date(2000, time.January, 12, 0, 0, 0, 0, time.UTC),
Want: "12. Januar 2000",
},
},
}
test.Run(t, zyt.German)
}
func TestAustrianGerman(t *testing.T) {
test := zyttesting.LocaleTest{
Format: []zyttesting.FormatTest{
{
Name: "rfc3339",
Layout: time.RFC3339,
Value: time.Date(2023, time.February, 3, 3, 5, 6, 0, time.UTC),
Want: "2023-02-03T03:05:06Z",
},
{
Name: "rfc822",
Layout: time.RFC822,
Value: time.Date(2023, time.January, 2, 15, 4, 0, 0, time.UTC),
Want: "02 Jän. 23 15:04 UTC",
},
{
Name: "long",
Layout: "2. January 2006",
Value: time.Date(2000, time.January, 12, 0, 0, 0, 0, time.UTC),
Want: "12. Jänner 2000",
},
},
}
test.Run(t, zyt.AustrianGerman)
}