Skip to content

Commit

Permalink
Merge pull request #4960 from etcwilde/ewilde/remove-removed-timezones
Browse files Browse the repository at this point in the history
[5.10] Removing checks for deleted timezones
  • Loading branch information
shahmishal committed May 31, 2024
2 parents 1a538a2 + fd74a7a commit 635aecd
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
8 changes: 4 additions & 4 deletions Darwin/Foundation-swiftoverlay-Tests/TestTimeZone.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ class TestTimeZone : XCTestCase {
func test_AnyHashableContainingTimeZone() {
let values: [TimeZone] = [
TimeZone(identifier: "America/Los_Angeles")!,
TimeZone(identifier: "Europe/Kiev")!,
TimeZone(identifier: "Europe/Kiev")!,
TimeZone(identifier: "Europe/Kyiv")!,
TimeZone(identifier: "Europe/Kyiv")!,
]
let anyHashables = values.map(AnyHashable.init)
expectEqual(TimeZone.self, type(of: anyHashables[0].base))
Expand All @@ -66,8 +66,8 @@ class TestTimeZone : XCTestCase {
func test_AnyHashableCreatedFromNSTimeZone() {
let values: [NSTimeZone] = [
NSTimeZone(name: "America/Los_Angeles")!,
NSTimeZone(name: "Europe/Kiev")!,
NSTimeZone(name: "Europe/Kiev")!,
NSTimeZone(name: "Europe/Kyiv")!,
NSTimeZone(name: "Europe/Kyiv")!,
]
let anyHashables = values.map(AnyHashable.init)
expectEqual(TimeZone.self, type(of: anyHashables[0].base))
Expand Down
2 changes: 1 addition & 1 deletion Tests/Foundation/Tests/TestCalendar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class TestCalendar: XCTestCase {

func test_nextDate() throws {
var calendar = Calendar.current
calendar.timeZone = try XCTUnwrap(TimeZone(identifier: "US/Pacific"))
calendar.timeZone = try XCTUnwrap(TimeZone(identifier: "America/Los_Angeles"))
let date_20200101 = try XCTUnwrap(calendar.date(from: DateComponents(year: 2020, month: 01, day: 1)))

do {
Expand Down
11 changes: 7 additions & 4 deletions Tests/Foundation/Tests/TestNSCalendar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,11 @@ class TestNSCalendar: XCTestCase {
try yield(to: block, (.chinese, "zh_CN", "Asia/Hong_Kong", "2015-04-02 07:13:22 +0800"))
try yield(to: block, (.chinese, "zh_CN", "Asia/Hong_Kong", "2014-10-16 06:12:10 +0800"))

#if !os(Windows)
#if !os(Windows) && !os(Linux)
// TODO: these are deprecated aliases which are unavailable on Windows,
// it is unclear if the support for the old names need to be validated.
// TODO: these aliases have been removed from recent versions of Linux
// as well
try yield(to: block, (.hebrew, "he_IL", "Israel", "2018-12-24 05:40:43 +0200"))
try yield(to: block, (.hebrew, "he_IL", "Israel", "2019-03-22 09:23:26 +0200"))
#endif
Expand Down Expand Up @@ -505,8 +507,9 @@ class TestNSCalendar: XCTestCase {
try yield(to: block, (.gregorian, "en_US", "America/Los_Angeles", "2013-03-26 10:04:16 -0700", "2013-03-26 00:00:00 -0700"))
try yield(to: block, (.gregorian, "pt_BR", "America/Sao_Paulo", "2013-10-20 13:10:20 -0200", "2013-10-20 01:00:00 -0200")) // DST jump forward at midnight
try yield(to: block, (.gregorian, "pt_BR", "America/Sao_Paulo", "2014-02-15 23:59:59 -0300", "2014-02-15 00:00:00 -0200")) // DST jump backward
#if !os(Windows)
// TODO: these are deprecated aliases which are unavailable on Windows,
#if !os(Windows) && !os(Linux)
// TODO: these are deprecated aliases which are unavailable on Windows
// and updated Linux distributions,
// it is unclear if the support for the old names need to be validated.
try yield(to: block, (.gregorian, "pt_BR", "Brazil/East", "2013-10-20 13:10:20 -0200", "2013-10-20 01:00:00 -0200")) // DST jump forward at midnight
try yield(to: block, (.gregorian, "pt_BR", "Brazil/East", "2014-02-15 23:59:59 -0300", "2014-02-15 00:00:00 -0200")) // DST jump backward
Expand Down Expand Up @@ -751,7 +754,7 @@ class TestNSCalendar: XCTestCase {
try yield(to: block, (.islamic, "ar_SA", "Asia/Riyadh", "2015-05-29 00:00:00 +0300", "2015-05-31 00:00:00 +0300")) // islamic
try yield(to: block, (.islamicCivil, "ar_SA", "Asia/Riyadh", "2015-05-29 00:00:00 +0300", "2015-05-31 00:00:00 +0300")) // islamic-civil
try yield(to: block, (.chinese, "zh_CN", "Asia/Hong_Kong", "2015-01-03 00:00:00 +0800", "2015-01-05 00:00:00 +0800")) // chinese
#if !os(Windows)
#if !os(Windows) && !os(Linux)
// TODO: these are deprecated aliases which are unavailable on Windows,
// it is unclear if the support for the old names need to be validated.
try yield(to: block, (.hebrew, "he_IL", "Israel", "2018-03-23 00:00:00 +0200", "2018-03-25 00:00:00 +0300")) // weekend with DST jump
Expand Down
10 changes: 5 additions & 5 deletions Tests/Foundation/Tests/TestTimeZone.swift
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,13 @@ class TestTimeZone: XCTestCase {
}

func test_isDaylightSavingTime() throws {
let eukv = try XCTUnwrap(TimeZone(identifier: "Europe/Kiev"))
let eulon = try XCTUnwrap(TimeZone(identifier: "Europe/London"))

let dateNoDST = Date(timeIntervalSince1970: 1585432800.0) // March 29, 2020
let dateDST = Date(timeIntervalSince1970: 1585515600.0) // March 30, 2020
XCTAssertFalse(eukv.isDaylightSavingTime(for: dateNoDST))
XCTAssertTrue(eukv.isDaylightSavingTime(for: dateDST))

XCTAssertFalse(eulon.isDaylightSavingTime(for: dateNoDST))
XCTAssertTrue(eulon.isDaylightSavingTime(for: dateDST))
}

static var allTests: [(String, (TestTimeZone) -> () throws -> Void)] {
Expand Down

0 comments on commit 635aecd

Please sign in to comment.