You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
XCTAssert(nextDaylightSavingTimeTransition1 == nextDaylightSavingTimeTransition2 || nextDaylightSavingTimeTransition2 == nextDaylightSavingTimeTransition3,"\(nextDaylightSavingTimeTransition1) should be equal to \(nextDaylightSavingTimeTransition2), or in the rare circumstance where a daylight saving time transition has just occurred, \(nextDaylightSavingTimeTransition2) should be equal to \(nextDaylightSavingTimeTransition3)")
115
+
XCTAssert(nextDaylightSavingTimeTransition1 == nextDaylightSavingTimeTransition2 || nextDaylightSavingTimeTransition2 == nextDaylightSavingTimeTransition3,"\(nextDaylightSavingTimeTransition1asOptional) should be equal to \(nextDaylightSavingTimeTransition2asOptional), or in the rare circumstance where a daylight saving time transition has just occurred, \(nextDaylightSavingTimeTransition2asOptional) should be equal to \(nextDaylightSavingTimeTransition3asOptional)")
116
116
}
117
117
118
118
func test_knownTimeZoneNames(){
@@ -137,18 +137,18 @@ class TestNSTimeZone: XCTestCase {
137
137
func test_initializingTimeZoneWithOffset(){
138
138
lettz=TimeZone(identifier:"GMT-0400")
139
139
XCTAssertNotNil(tz)
140
-
letseconds= tz?.secondsFromGMT(for:Date())
140
+
letseconds= tz?.secondsFromGMT(for:Date())??0
141
141
XCTAssertEqual(seconds,-14400,"GMT-0400 should be -14400 seconds but got \(seconds) instead")
142
142
143
143
lettz2=TimeZone(secondsFromGMT:-14400)
144
144
XCTAssertNotNil(tz2)
145
145
letexpectedName="GMT-0400"
146
146
letactualName= tz2?.identifier
147
-
XCTAssertEqual(actualName, expectedName,"expected name \"\(expectedName)\" is not equal to \"\(actualName)\"")
147
+
XCTAssertEqual(actualName, expectedName,"expected name \"\(expectedName)\" is not equal to \"\(actualNameasOptional)\"")
XCTAssertEqual(actualLocalizedName, expectedLocalizedName,"expected name \"\(expectedLocalizedName)\" is not equal to \"\(actualLocalizedName)\"")
151
-
letseconds2= tz2?.secondsFromGMT()
150
+
XCTAssertEqual(actualLocalizedName, expectedLocalizedName,"expected name \"\(expectedLocalizedName)\" is not equal to \"\(actualLocalizedNameasOptional)\"")
151
+
letseconds2= tz2?.secondsFromGMT()??0
152
152
XCTAssertEqual(seconds2,-14400,"GMT-0400 should be -14400 seconds but got \(seconds2) instead")
153
153
154
154
lettz3=TimeZone(identifier:"GMT-9999")
@@ -161,8 +161,9 @@ class TestNSTimeZone: XCTestCase {
161
161
XCTAssertNil(tz)
162
162
// Test valid timezone abbreviation of "AST" for "America/Halifax"
163
163
tz =TimeZone(abbreviation:"AST")
164
-
letexpectedName="America/Halifax"
165
-
XCTAssertEqual(tz?.identifier, expectedName,"expected name \"\(expectedName)\" is not equal to \"\(tz?.identifier)\"")
164
+
letexpectedIdentifier="America/Halifax"
165
+
letactualIdentifier= tz?.identifier
166
+
XCTAssertEqual(actualIdentifier, expectedIdentifier,"expected identifier \"\(expectedIdentifier)\" is not equal to \"\(actualIdentifier asOptional)\"")
0 commit comments