-
Notifications
You must be signed in to change notification settings - Fork 195
Begin converting FoundationInternationalizationTests to swift-testing #1381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@swift-ci please test |
#expect(weekDayStyle.format(date..<date + day) == "Mon – Tue") | ||
#expect(weekDayStyle.format(date..<date + day * 32) == "Mon – Fri") | ||
// This style doesn't really make sense since the gap between `weekDay` and `hour` makes the result AMbiguous. ICU fills the missing pieces on our behalf. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if intentional but this is kinda punny and I like it 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha sadly I can't claim credit for this one, no idea how that happened - it must have somehow been one of my regex copy and pastes gone wrong back with the original patch. But I agree the pun is great haha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kudos to @jrflat for finding a punneedle in this haystack of changes
#expect(weekDayStyle.format(date..<date + day) == "Mon – Tue") | ||
#expect(weekDayStyle.format(date..<date + day * 32) == "Mon – Fri") | ||
// This style doesn't really make sense since the gap between `weekDay` and `hour` makes the result AMbiguous. ICU fills the missing pieces on our behalf. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kudos to @jrflat for finding a punneedle in this haystack of changes
@@ -23,7 +23,7 @@ import Testing | |||
@Suite("Gregorian Calendar (Internationalization)") | |||
private struct GregorianCalendarInternationalizationTests { | |||
@Test func copy() { | |||
let gregorianCalendar = _CalendarGregorian(identifier: .gregorian, timeZone: nil, locale: nil, firstWeekday: 5, minimumDaysInFirstWeek: 3, gregorianStartDate: nil) | |||
let gregorianCalendar = _CalendarGregorian(identifier: .gregorian, timeZone: .gmt, locale: nil, firstWeekday: 5, minimumDaysInFirstWeek: 3, gregorianStartDate: nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a note to myself, but we should probably lift this logic of falling back to the current time zone out of _CalendarGregorian
:/ Seems like a footgun even just for unit tests
This applies changes from #908 to all files for which the changes apply cleanly which covers a significant number of tests. I'll come back with separate PRs to update the patches for files that have changed since the initial audit, but this updates all suites that cleanly apply.
The main change from #908 is how we handle tests that read or mutate the current Locale/TimeZone/Calendar. Instead of using a parent suite to serialize these tests, we use a global actor which tests await work on that depends on these values. The global actor also ensures that the current Calendar/Locale/TimeZone are reset back to their default values after each test to ensure mutations from one test don't have any interactions with future tests. Since XCTest tests all run before swift-testing tests begin, it's ok that XCTests that have yet to be converted might mutate this state while we're working to convert everything over.