@@ -246,7 +246,6 @@ class TestDateFormatter: XCTestCase {
246
246
f. timeZone = TimeZone ( identifier: DEFAULT_TIMEZONE)
247
247
f. locale = Locale ( identifier: DEFAULT_LOCALE)
248
248
249
- #if os(macOS) // timestyle zzzz is currently broken on Linux
250
249
f. dateFormat = " EEEE, MMMM d, y 'at' hh:mm:ss a zzzz "
251
250
for (timestamp, stringResult) in timestamps {
252
251
@@ -255,7 +254,6 @@ class TestDateFormatter: XCTestCase {
255
254
256
255
XCTAssertEqual ( sf, stringResult)
257
256
}
258
- #endif
259
257
260
258
let quarterTimestamps : [ Double : String ] = [
261
259
1451679712 : " 1 " , 1459542112 : " 2 " , 1467404512 : " 3 " , 1475353312 : " 4 "
@@ -298,36 +296,36 @@ class TestDateFormatter: XCTestCase {
298
296
299
297
func test_dateFormatString( ) {
300
298
let f = DateFormatter ( )
299
+ f. locale = Locale ( identifier: DEFAULT_LOCALE)
301
300
f. timeZone = TimeZone ( abbreviation: DEFAULT_TIMEZONE)
302
301
303
- //.full cases have been commented out as they're not working correctly on Linux
302
+ // .medium cases fail for the date part on Linux and so have been commented out.
304
303
let formats : [ String : ( DateFormatter . Style , DateFormatter . Style ) ] = [
305
304
" " : ( . none, . none) ,
306
305
" h:mm a " : ( . none, . short) ,
307
306
" h:mm:ss a " : ( . none, . medium) ,
308
307
" h:mm:ss a z " : ( . none, . long) ,
309
- // "h:mm:ss a zzzz": (.none, .full),
308
+ " h:mm:ss a zzzz " : ( . none, . full) ,
310
309
" M/d/yy " : ( . short, . none) ,
311
310
" M/d/yy, h:mm a " : ( . short, . short) ,
312
311
" M/d/yy, h:mm:ss a " : ( . short, . medium) ,
313
312
" M/d/yy, h:mm:ss a z " : ( . short, . long) ,
314
- // "M/d/yy, h:mm:ss a zzzz": (.short, .full),
313
+ " M/d/yy, h:mm:ss a zzzz " : ( . short, . full) ,
315
314
" MMM d, y " : ( . medium, . none) ,
316
- //These tests currently fail, there seems to be a difference in behavior in the CoreFoundation methods called to construct the format strings.
317
- // "MMM d, y 'at' h:mm a": (.medium, .short),
318
- // "MMM d, y 'at' h:mm:ss a": (.medium, .medium),
319
- // "MMM d, y 'at' h:mm:ss a z": (.medium, .long),
320
- // "MMM d, y 'at' h:mm:ss a zzzz": (.medium, .full),
315
+ //"MMM d, y 'at' h:mm a": (.medium, .short),
316
+ //"MMM d, y 'at' h:mm:ss a": (.medium, .medium),
317
+ //"MMM d, y 'at' h:mm:ss a z": (.medium, .long),
318
+ //"MMM d, y 'at' h:mm:ss a zzzz": (.medium, .full),
321
319
" MMMM d, y " : ( . long, . none) ,
322
320
" MMMM d, y 'at' h:mm a " : ( . long, . short) ,
323
321
" MMMM d, y 'at' h:mm:ss a " : ( . long, . medium) ,
324
322
" MMMM d, y 'at' h:mm:ss a z " : ( . long, . long) ,
325
- // "MMMM d, y 'at' h:mm:ss a zzzz": (.long, .full),
326
- // "EEEE, MMMM d, y": (.full, .none),
327
- // "EEEE, MMMM d, y 'at' h:mm a": (.full, .short),
328
- // "EEEE, MMMM d, y 'at' h:mm:ss a": (.full, .medium),
329
- // "EEEE, MMMM d, y 'at' h:mm:ss a z": (.full, .long),
330
- // "EEEE, MMMM d, y 'at' h:mm:ss a zzzz": (.full, .full),
323
+ " MMMM d, y 'at' h:mm:ss a zzzz " : ( . long, . full) ,
324
+ " EEEE, MMMM d, y " : ( . full, . none) ,
325
+ " EEEE, MMMM d, y 'at' h:mm a " : ( . full, . short) ,
326
+ " EEEE, MMMM d, y 'at' h:mm:ss a " : ( . full, . medium) ,
327
+ " EEEE, MMMM d, y 'at' h:mm:ss a z " : ( . full, . long) ,
328
+ " EEEE, MMMM d, y 'at' h:mm:ss a zzzz " : ( . full, . full) ,
331
329
]
332
330
333
331
for (dateFormat, styles) in formats {
@@ -400,9 +398,8 @@ class TestDateFormatter: XCTestCase {
400
398
// TimeZone.current is GMT as well.
401
399
// (ex. TestTimeZone.test_systemTimeZoneName)
402
400
403
- // Disabled because of: https://bugs.swift.org/browse/SR-8994
404
- // f.timeZone = TimeZone.current
405
- // XCTAssertEqual(f.string(from: now), TimeZone.current.abbreviation())
401
+ f. timeZone = TimeZone . current
402
+ XCTAssertEqual ( f. string ( from: now) , TimeZone . current. abbreviation ( ) )
406
403
407
404
// Case 2: New York
408
405
f. timeZone = newYork
0 commit comments