Skip to content

Commit 568a069

Browse files
authored
Merge pull request swiftlang#2644 from spevans/pr_sr_8994
2 parents 4a3fe0d + c284a02 commit 568a069

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

Diff for: TestFoundation/TestDateFormatter.swift

+16-19
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ class TestDateFormatter: XCTestCase {
246246
f.timeZone = TimeZone(identifier: DEFAULT_TIMEZONE)
247247
f.locale = Locale(identifier: DEFAULT_LOCALE)
248248

249-
#if os(macOS) // timestyle zzzz is currently broken on Linux
250249
f.dateFormat = "EEEE, MMMM d, y 'at' hh:mm:ss a zzzz"
251250
for (timestamp, stringResult) in timestamps {
252251

@@ -255,7 +254,6 @@ class TestDateFormatter: XCTestCase {
255254

256255
XCTAssertEqual(sf, stringResult)
257256
}
258-
#endif
259257

260258
let quarterTimestamps: [Double : String] = [
261259
1451679712 : "1", 1459542112 : "2", 1467404512 : "3", 1475353312 : "4"
@@ -298,36 +296,36 @@ class TestDateFormatter: XCTestCase {
298296

299297
func test_dateFormatString() {
300298
let f = DateFormatter()
299+
f.locale = Locale(identifier: DEFAULT_LOCALE)
301300
f.timeZone = TimeZone(abbreviation: DEFAULT_TIMEZONE)
302301

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.
304303
let formats: [String: (DateFormatter.Style, DateFormatter.Style)] = [
305304
"": (.none, .none),
306305
"h:mm a": (.none, .short),
307306
"h:mm:ss a": (.none, .medium),
308307
"h:mm:ss a z": (.none, .long),
309-
// "h:mm:ss a zzzz": (.none, .full),
308+
"h:mm:ss a zzzz": (.none, .full),
310309
"M/d/yy": (.short, .none),
311310
"M/d/yy, h:mm a": (.short, .short),
312311
"M/d/yy, h:mm:ss a": (.short, .medium),
313312
"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),
315314
"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),
321319
"MMMM d, y": (.long, .none),
322320
"MMMM d, y 'at' h:mm a": (.long, .short),
323321
"MMMM d, y 'at' h:mm:ss a": (.long, .medium),
324322
"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),
331329
]
332330

333331
for (dateFormat, styles) in formats {
@@ -400,9 +398,8 @@ class TestDateFormatter: XCTestCase {
400398
// TimeZone.current is GMT as well.
401399
// (ex. TestTimeZone.test_systemTimeZoneName)
402400

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())
406403

407404
// Case 2: New York
408405
f.timeZone = newYork

0 commit comments

Comments
 (0)