Skip to content

Commit 3173c28

Browse files
committed
Fix leadingDotSyntax test reliance on current i18n preferences
1 parent 57b6c0c commit 3173c28

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Tests/FoundationInternationalizationTests/Formatting/DateFormatStyleTests.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ private struct DateFormatStyleTests {
190190
@Test func leadingDotSyntax() async {
191191
let date = Date.now
192192
let locale = Locale(identifier: "es_ES")
193+
let timeZone = TimeZone.gmt
194+
var calendar = Calendar(identifier: .gregorian)
195+
calendar.timeZone = timeZone
193196
await usingCurrentInternationalizationPreferences {
194197
#expect(date.formatted(date: .long, time: .complete) == date.formatted(Date.FormatStyle(date: .long, time: .complete)))
195198
}
@@ -200,13 +203,17 @@ private struct DateFormatStyleTests {
200203
.month()
201204
.year()
202205
.locale(locale)
206+
.timeZone(timeZone)
207+
.calendar(calendar)
203208
) ==
204209
date.formatted(
205210
Date.FormatStyle()
206211
.day()
207212
.month()
208213
.year()
209214
.locale(locale)
215+
.timeZone(timeZone)
216+
.calendar(calendar)
210217
)
211218
)
212219
}

Tests/FoundationInternationalizationTests/Formatting/DateIntervalFormatStyleTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ private struct DateIntervalFormatStyleTests {
106106
// This test assumes both the left side and the right side of the comparison has the same `Locale.autoupdatingCurrent`, which assumes the state of the host machine remains unchanged.
107107
#expect(range.formatted() == Date.IntervalFormatStyle().format(range))
108108
#expect(range.formatted(date: .numeric, time: .shortened) == Date.IntervalFormatStyle(date: .numeric, time: .shortened).format(range))
109+
#expect(range.formatted(.interval.day().month().year().locale(locale)) == Date.IntervalFormatStyle().day().month().year().locale(locale).format(range))
109110
}
110111

111-
#expect(range.formatted(.interval.day().month().year().locale(locale)) == Date.IntervalFormatStyle().day().month().year().locale(locale).format(range))
112112
}
113113

114114
#if FIXED_ICU_74_DAYPERIOD

0 commit comments

Comments
 (0)