Skip to content

Commit 1934da2

Browse files
committed
Fix test
1 parent 61ef738 commit 1934da2

File tree

2 files changed

+141
-54
lines changed

2 files changed

+141
-54
lines changed

const_test.go

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7,303 +7,303 @@ import (
77
func TestConstDate(test *testing.T) {
88
_, err := ParseWithFormats("20151024", []string{Date})
99
if err != nil {
10-
test.Errorf("Invalid date/time")
10+
test.Error("Invalid date/time")
1111
}
1212
}
1313

1414
func TestConstMMDDYYYY(test *testing.T) {
1515
_, err := ParseWithFormats("10/24/2015", []string{MMDDYYYY})
1616
if err != nil {
17-
test.Errorf("Invalid date/time")
17+
test.Error("Invalid date/time")
1818
}
1919
}
2020

2121
func TestConstShortTime(test *testing.T) {
2222
_, err := ParseWithFormats("05:58 PM", []string{ShortTime})
2323
if err != nil {
24-
test.Errorf("Invalid date/time")
24+
test.Error("Invalid date/time")
2525
}
2626

2727
_, err = ParseWithFormats("05:58 AM", []string{ShortTime})
2828
if err != nil {
29-
test.Errorf("Invalid date/time")
29+
test.Error("Invalid date/time")
3030
}
3131
}
3232

3333
func TestConstLongTime(test *testing.T) {
3434
_, err := ParseWithFormats("05:58:03 PM", []string{LongTime})
3535
if err != nil {
36-
test.Errorf("Invalid date/time")
36+
test.Error("Invalid date/time")
3737
}
3838

3939
_, err = ParseWithFormats("05:58:03 AM", []string{LongTime})
4040
if err != nil {
41-
test.Errorf("Invalid date/time")
41+
test.Error("Invalid date/time")
4242
}
4343
}
4444

4545
func TestConstANSICAsctime(test *testing.T) {
4646
_, err := ParseWithFormats("Sun Oct 25 00:03:45 2015", []string{ANSICAsctime})
4747
if err != nil {
48-
test.Errorf("Invalid date/time")
48+
test.Error("Invalid date/time")
4949
}
5050
}
5151

5252
func TestConstRFC850NoWeekday(test *testing.T) {
5353
_, err := ParseWithFormats("25-Oct-15 00:03:45 UTC", []string{RFC850NoWeekday})
5454
if err != nil {
55-
test.Errorf("Invalid date/time")
55+
test.Error("Invalid date/time")
5656
}
5757
}
5858

5959
func TestConstRFC850NoTime(test *testing.T) {
6060
_, err := ParseWithFormats("25-Oct-15", []string{RFC850NoTime})
6161
if err != nil {
62-
test.Errorf("Invalid date/time")
62+
test.Error("Invalid date/time")
6363
}
6464
}
6565

6666
func TestConstBrokenRFC850(test *testing.T) {
6767
_, err := ParseWithFormats("Sunday, 25-Oct-2015 00:03:45 UTC", []string{BrokenRFC850})
6868
if err != nil {
69-
test.Errorf("Invalid date/time")
69+
test.Error("Invalid date/time")
7070
}
7171
}
7272

7373
func TestConstBrokenRFC850NoWeekday(test *testing.T) {
7474
_, err := ParseWithFormats("25-Oct-2015 00:03:45 UTC", []string{BrokenRFC850NoWeekday})
7575
if err != nil {
76-
test.Errorf("Invalid date/time")
76+
test.Error("Invalid date/time")
7777
}
7878
}
7979

8080
func TestConstBrokenRFC850NoTime(test *testing.T) {
8181
_, err := ParseWithFormats("25-Oct-2015", []string{BrokenRFC850NoTime})
8282
if err != nil {
83-
test.Errorf("Invalid date/time")
83+
test.Error("Invalid date/time")
8484
}
8585
}
8686

8787
func TestConstCommonLog(test *testing.T) {
8888
_, err := ParseWithFormats("17/Sep/2014:21:14:24 +0000", []string{CommonLog})
8989
if err != nil {
90-
test.Errorf("Invalid date/time")
90+
test.Error("Invalid date/time")
9191
}
9292
}
9393

9494
func TestConstCommonLogNoTime(test *testing.T) {
9595
_, err := ParseWithFormats("17/Sep/2014", []string{CommonLogNoTime})
9696
if err != nil {
97-
test.Errorf("Invalid date/time")
97+
test.Error("Invalid date/time")
9898
}
9999
}
100100

101101
func TestConstLsDate(test *testing.T) {
102102
_, err := ParseWithFormats("Oct 25 2015", []string{LsDate})
103103
if err != nil {
104-
test.Errorf("Invalid date/time")
104+
test.Error("Invalid date/time")
105105
}
106106
}
107107

108108
func TestConstLsTime(test *testing.T) {
109109
_, err := ParseWithFormats("Oct 25 00:03", []string{LsTime})
110110
if err != nil {
111-
test.Errorf("Invalid date/time")
111+
test.Error("Invalid date/time")
112112
}
113113
}
114114

115115
func TestConstWindowsDir(test *testing.T) {
116116
_, err := ParseWithFormats("10-25-15 00:03AM", []string{WindowsDir})
117117
if err != nil {
118-
test.Errorf("Invalid date/time")
118+
test.Error("Invalid date/time")
119119
}
120120
}
121121

122122
func TestConstISO8601DateHour(test *testing.T) {
123123
_, err := ParseWithFormats("2015-10-25 00", []string{ISO8601DateHour})
124124
if err != nil {
125-
test.Errorf("Invalid date/time")
125+
test.Error("Invalid date/time")
126126
}
127127
}
128128

129129
func TestConstISO8601DateHourMin(test *testing.T) {
130130
_, err := ParseWithFormats("2015-10-25 00:03", []string{ISO8601DateHourMin})
131131
if err != nil {
132-
test.Errorf("Invalid date/time")
132+
test.Error("Invalid date/time")
133133
}
134134
}
135135

136136
func TestConstISO8601Datetime(test *testing.T) {
137137
_, err := ParseWithFormats("2015-10-25 00:03:45", []string{ISO8601Datetime})
138138
if err != nil {
139-
test.Errorf("Invalid date/time")
139+
test.Error("Invalid date/time")
140140
}
141141
}
142142

143143
func TestConstISO8601DatetimeCompact(test *testing.T) {
144144
_, err := ParseWithFormats("20151025 000345", []string{ISO8601DatetimeCompact})
145145
if err != nil {
146-
test.Errorf("Invalid date/time")
146+
test.Error("Invalid date/time")
147147
}
148148
}
149149

150150
func TestConstISO8601DatetimeCompactUTC(test *testing.T) {
151151
_, err := ParseWithFormats("20151025 000345Z", []string{ISO8601DatetimeCompactUTC})
152152
if err != nil {
153-
test.Errorf("Invalid date/time")
153+
test.Error("Invalid date/time")
154154
}
155155
}
156156

157157
func TestConstISO8601DatetimeOffset(test *testing.T) {
158158
_, err := ParseWithFormats("2015-10-25 00:03:45+00:00", []string{ISO8601DatetimeOffset})
159159
if err != nil {
160-
test.Errorf("Invalid date/time")
160+
test.Error("Invalid date/time")
161161
}
162162
}
163163

164164
func TestConstISO8601DatetimeOffsetTZD(test *testing.T) {
165165
_, err := ParseWithFormats("2015-10-25 00:03:45+00:00 UTC", []string{ISO8601DatetimeOffsetTZD})
166166
if err != nil {
167-
test.Errorf("Invalid date/time")
167+
test.Error("Invalid date/time")
168168
}
169169
}
170170

171171
func TestConstISO8601DatetimeFracSecOffset(test *testing.T) {
172172
_, err := ParseWithFormats("2015-10-25 00:03:45.123456789+00:00", []string{ISO8601DatetimeFracSecOffset})
173173
if err != nil {
174-
test.Errorf("Invalid date/time")
174+
test.Error("Invalid date/time")
175175
}
176176
}
177177

178178
func TestConstISO8601DatetimeFracSecUTC(test *testing.T) {
179179
_, err := ParseWithFormats("2015-10-25 00:03:45.123456789Z", []string{ISO8601DatetimeFracSecUTC})
180180
if err != nil {
181-
test.Errorf("Invalid date/time")
181+
test.Error("Invalid date/time")
182182
}
183183
}
184184

185185
func TestConstISO8601DatetimeFracSec(test *testing.T) {
186186
_, err := ParseWithFormats("2015-10-25 00:03:45.123456789", []string{ISO8601DatetimeFracSec})
187187
if err != nil {
188-
test.Errorf("Invalid date/time")
188+
test.Error("Invalid date/time")
189189
}
190190
}
191191

192192
func TestConstISO8601DatetimeOffset2(test *testing.T) {
193193
_, err := ParseWithFormats("2015-10-25 00:03:45 +00:00", []string{ISO8601DatetimeOffset2})
194194
if err != nil {
195-
test.Errorf("Invalid date/time")
195+
test.Error("Invalid date/time")
196196
}
197197
}
198198

199199
func TestConstISO8601DatetimeOffsetTZD2(test *testing.T) {
200200
_, err := ParseWithFormats("2015-10-25 00:03:45 +00:00 UTC", []string{ISO8601DatetimeOffsetTZD2})
201201
if err != nil {
202-
test.Errorf("Invalid date/time")
202+
test.Error("Invalid date/time")
203203
}
204204
}
205205

206206
func TestConstISO8601DatetimeFracSecOffset2(test *testing.T) {
207207
_, err := ParseWithFormats("2015-10-25 00:03:45.123456789 +00:00", []string{ISO8601DatetimeFracSecOffset2})
208208
if err != nil {
209-
test.Errorf("Invalid date/time")
209+
test.Error("Invalid date/time")
210210
}
211211
}
212212

213213
func TestConstISO8601TDateHour(test *testing.T) {
214214
_, err := ParseWithFormats("2015-10-25T00", []string{ISO8601TDateHour})
215215
if err != nil {
216-
test.Errorf("Invalid date/time")
216+
test.Error("Invalid date/time")
217217
}
218218
}
219219

220220
func TestConstISO8601TDateHourMin(test *testing.T) {
221221
_, err := ParseWithFormats("2015-10-25T00:03", []string{ISO8601TDateHourMin})
222222
if err != nil {
223-
test.Errorf("Invalid date/time")
223+
test.Error("Invalid date/time")
224224
}
225225
}
226226

227227
func TestConstISO8601TDatetime(test *testing.T) {
228228
_, err := ParseWithFormats("2015-10-25T00:03:45", []string{ISO8601TDatetime})
229229
if err != nil {
230-
test.Errorf("Invalid date/time")
230+
test.Error("Invalid date/time")
231231
}
232232
}
233233

234234
func TestConstISO8601TDatetimeCompact(test *testing.T) {
235235
_, err := ParseWithFormats("20151025T000345", []string{ISO8601TDatetimeCompact})
236236
if err != nil {
237-
test.Errorf("Invalid date/time")
237+
test.Error("Invalid date/time")
238238
}
239239
}
240240

241241
func TestConstISO8601TDatetimeCompactUTC(test *testing.T) {
242242
_, err := ParseWithFormats("20151025T000345Z", []string{ISO8601TDatetimeCompactUTC})
243243
if err != nil {
244-
test.Errorf("Invalid date/time")
244+
test.Error("Invalid date/time")
245245
}
246246
}
247247

248248
func TestConstISO8601TDatetimeOffset(test *testing.T) {
249249
_, err := ParseWithFormats("2015-10-25T00:03:45+00:00", []string{ISO8601TDatetimeOffset})
250250
if err != nil {
251-
test.Errorf("Invalid date/time")
251+
test.Error("Invalid date/time")
252252
}
253253
}
254254

255255
func TestConstISO8601TDatetimeOffsetTZD(test *testing.T) {
256256
_, err := ParseWithFormats("2015-10-25T00:03:45+00:00 UTC", []string{ISO8601TDatetimeOffsetTZD})
257257
if err != nil {
258-
test.Errorf("Invalid date/time")
258+
test.Error("Invalid date/time")
259259
}
260260
}
261261

262262
func TestConstISO8601TDatetimeFracSecOffset(test *testing.T) {
263263
_, err := ParseWithFormats("2015-10-25T00:03:45.123456789+00:00", []string{ISO8601TDatetimeFracSecOffset})
264264
if err != nil {
265-
test.Errorf("Invalid date/time")
265+
test.Error("Invalid date/time")
266266
}
267267
}
268268

269269
func TestConstISO8601TDatetimeFracSecUTC(test *testing.T) {
270270
_, err := ParseWithFormats("2015-10-25T00:03:45.123456789Z", []string{ISO8601TDatetimeFracSecUTC})
271271
if err != nil {
272-
test.Errorf("Invalid date/time")
272+
test.Error("Invalid date/time")
273273
}
274274
}
275275

276276
func TestConstISO8601TDatetimeFracSec(test *testing.T) {
277277
_, err := ParseWithFormats("2015-10-25T00:03:45.123456789", []string{ISO8601TDatetimeFracSec})
278278
if err != nil {
279-
test.Errorf("Invalid date/time")
279+
test.Error("Invalid date/time")
280280
}
281281
}
282282

283283
func TestConstISO8601Date(test *testing.T) {
284284
_, err := ParseWithFormats("2015-10-25", []string{ISO8601Date})
285285
if err != nil {
286-
test.Errorf("Invalid date/time")
286+
test.Error("Invalid date/time")
287287
}
288288
}
289289

290290
func TestConstISO8601Time(test *testing.T) {
291291
_, err := ParseWithFormats("00:03:45", []string{ISO8601Time})
292292
if err != nil {
293-
test.Errorf("Invalid date/time")
293+
test.Error("Invalid date/time")
294294
}
295295
}
296296

297297
func TestConstISO8601TimeOffset(test *testing.T) {
298298
_, err := ParseWithFormats("00:03:45+00:00", []string{ISO8601TimeOffset})
299299
if err != nil {
300-
test.Errorf("Invalid date/time")
300+
test.Error("Invalid date/time")
301301
}
302302
}
303303

304304
func TestConstMMDDYYYYDatetime(test *testing.T) {
305305
_, err := ParseWithFormats("10/25/2015 00:03:45", []string{MMDDYYYYDatetime})
306306
if err != nil {
307-
test.Errorf("Invalid date/time")
307+
test.Error("Invalid date/time")
308308
}
309309
}

0 commit comments

Comments
 (0)