Skip to content

Commit 9f3a74b

Browse files
authored
FoundationEssentialsTests: skip distant{Future,Past} tests on Windows (#677)
The MSVC libc does not properly handle dates that are far out from the Unix epoch. For the purposes of allowing the test suite to pass on CI, skip these tests on Windows.
1 parent 63be4bd commit 9f3a74b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Tests/FoundationEssentialsTests/DateTests.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,24 @@ final class DateTests : XCTestCase {
9090
XCTAssertEqual("1970-01-01 00:00:00 +0000", date.description)
9191
}
9292

93-
func testDescriptionDistantPast() {
93+
func testDescriptionDistantPast() throws {
94+
#if os(Windows)
95+
throw XCTSkip("ucrt does not support distant past")
96+
#else
9497
#if FOUNDATION_FRAMEWORK
9598
XCTAssertEqual("0001-01-01 00:00:00 +0000", Date.distantPast.description)
9699
#else
97100
XCTAssertEqual("0000-12-30 00:00:00 +0000", Date.distantPast.description)
101+
#endif
98102
#endif
99103
}
100104

101-
func testDescriptionDistantFuture() {
105+
func testDescriptionDistantFuture() throws {
106+
#if os(Windows)
107+
throw XCTSkip("ucrt does not support distant future")
108+
#else
102109
XCTAssertEqual("4001-01-01 00:00:00 +0000", Date.distantFuture.description)
110+
#endif
103111
}
104112

105113
func testDescriptionBeyondDistantPast() {

0 commit comments

Comments
 (0)