Skip to content

Commit 1600080

Browse files
committed
Actually fix all the missed copy-paste changes after fuzzification.
1 parent e395327 commit 1600080

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

TestFoundation/TestDateIntervalFormatter.swift

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ class TestDateIntervalFormatter: XCTestCase {
7979

8080
let result = formatter.string(from: older, to: newer)
8181
result.assertContainsInOrder("January 1", "2001", "12:00:00 AM", "Greenwich Mean Time",
82-
"February 4", "2001", "5:20:00 AM", "Greenwich Mean Time")
82+
"February 4", "2001", "5:20:00 PM", "Greenwich Mean Time")
8383
}
8484

8585
func testStringFromDateToDateAcrossThreeBillionSecondsReversed() {
8686
let older = Date(timeIntervalSinceReferenceDate: 0)
8787
let newer = Date(timeIntervalSinceReferenceDate: 3e9)
8888

89-
let result = formatter.string(from: older, to: newer)
89+
let result = formatter.string(from: newer, to: older)
9090
result.assertContainsInOrder("January 25", "2096", "5:20:00 AM", "Greenwich Mean Time",
9191
"January 1", "2001", "12:00:00 AM", "Greenwich Mean Time")
9292
}
@@ -95,25 +95,28 @@ class TestDateIntervalFormatter: XCTestCase {
9595
let older = Date(timeIntervalSinceReferenceDate: 0)
9696
let newer = Date(timeIntervalSinceReferenceDate: 3e6)
9797

98-
let result = formatter.string(from: older, to: newer)
99-
result.assertContainsInOrder("February 4", "2001", "5:20:00 AM", "Greenwich Mean Time",
98+
let result = formatter.string(from: newer, to: older)
99+
result.assertContainsInOrder("February 4", "2001", "5:20:00 PM", "Greenwich Mean Time",
100100
"January 1", "2001", "12:00:00 AM", "Greenwich Mean Time")
101101
}
102102

103-
func testStringFromDateToSameDate() {
103+
func testStringFromDateToSameDate() throws {
104104
let date = Date(timeIntervalSinceReferenceDate: 3e6)
105105

106106
// For a range from a date to itself, we represent the date only once, with no interdate separator.
107107
let result = formatter.string(from: date, to: date)
108-
result.assertContainsInOrder(requiresLastToBeAtEnd: true, "February 4", "2001", "5:20:00 AM", "Greenwich Mean Time")
108+
result.assertContainsInOrder(requiresLastToBeAtEnd: true, "February 4", "2001", "5:20:00 PM", "Greenwich Mean Time")
109+
110+
let firstFebruary = try result.range(of: "February").unwrapped()
111+
XCTAssertNil(result[firstFebruary.upperBound...].range(of: "February")) // February appears only once.
109112
}
110113

111114
func testStringFromDateIntervalAcrossThreeMillionSeconds() throws {
112115
let interval = DateInterval(start: Date(timeIntervalSinceReferenceDate: 0), duration: 3e6)
113116

114117
let result = try formatter.string(from: interval).unwrapped()
115118
result.assertContainsInOrder("January 1", "2001", "12:00:00 AM", "Greenwich Mean Time",
116-
"February 4", "2001", "5:20:00 AM", "Greenwich Mean Time")
119+
"February 4", "2001", "5:20:00 PM", "Greenwich Mean Time")
117120
}
118121

119122
func testStringFromDateToDateAcrossOneWeek() {
@@ -190,7 +193,7 @@ class TestDateIntervalFormatter: XCTestCase {
190193
let newer = Date(timeIntervalSinceReferenceDate: 3600 * 5)
191194

192195
let result = formatter.string(from: older, to: newer)
193-
result.assertContainsInOrder(requiresLastToBeAtEnd: true, "January", "1", "2001", "12:00:00 AM", "5:00:00 AM")
196+
result.assertContainsInOrder(requiresLastToBeAtEnd: true, "January", "1", "2001", "12:00:00 AM", "5:00:00 AM", "GMT")
194197

195198
let firstJanuary = try result.range(of: "January").unwrapped()
196199
XCTAssertNil(result[firstJanuary.upperBound...].range(of: "January")) // January appears only once.
@@ -200,10 +203,10 @@ class TestDateIntervalFormatter: XCTestCase {
200203
let older = Date(timeIntervalSinceReferenceDate: 3600 * 22)
201204
let newer = Date(timeIntervalSinceReferenceDate: 3600 * 27)
202205

203-
XCTAssertEqual(formatter.string(from: older, to: newer),
204-
"January 1, 2001, 10:00:00 PM Greenwich Mean Time – January 2, 2001, 3:00:00 AM Greenwich Mean Time")
205206
let result = formatter.string(from: older, to: newer)
206-
result.assertContainsInOrder(requiresLastToBeAtEnd: true, "January", "1", "2001", "10:00:00 AM", "5:00:00 AM")
207+
result.assertContainsInOrder(requiresLastToBeAtEnd: true,
208+
"January", "1", "2001", "10:00:00 PM", "Greenwich Mean Time",
209+
"January", "2", "2001", "3:00:00 AM", "Greenwich Mean Time")
207210
}
208211
}
209212

@@ -212,7 +215,7 @@ class TestDateIntervalFormatter: XCTestCase {
212215
let newer = Date(timeIntervalSinceReferenceDate: 3600 * 18)
213216

214217
let result = formatter.string(from: older, to: newer)
215-
result.assertContainsInOrder(requiresLastToBeAtEnd: true, "January", "1", "2001", "12:00:00 AM", "6:00:00 PM")
218+
result.assertContainsInOrder(requiresLastToBeAtEnd: true, "January", "1", "2001", "12:00:00 AM", "6:00:00 PM", "GMT")
216219

217220
let firstJanuary = try result.range(of: "January").unwrapped()
218221
XCTAssertNil(result[firstJanuary.upperBound...].range(of: "January")) // January appears only once.

0 commit comments

Comments
 (0)