Skip to content

Commit 1ea90b7

Browse files
authored
test_identifierTypesFromSpecialIdentifier() fails on Darwin (swiftlang#333)
This is caused by ICU's update: rdar://114361374. Introduce FIXED_ICU_20187 to indicate the ICU version with the fix and update test expectation behind the flag. The upstream change unicode-org/icu@1afef30 is scheduled to go into ICU 74. Darwin ICU picked this up earlier than their annual ICU update. When we update FoundationICU to ICU74 we should remove this flag and enable the desired behavior everywhere. Resolves rdar://118564689
1 parent ff9228b commit 1ea90b7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Tests/FoundationInternationalizationTests/LocaleTests.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,15 @@ final class LocaleTests : XCTestCase {
161161
return localeComponents
162162
}
163163

164+
#if FIXED_ICU_20187
165+
verify(cldr: "root", bcp47: "und", icu: "") {
166+
return Locale.Components(identifier: "")
167+
}
168+
#else
164169
verify(cldr: "root", bcp47: "und", icu: "en_US_POSIX") {
165170
return Locale.Components(identifier: "")
166171
}
172+
#endif
167173

168174
verify(cldr: "und_US", bcp47: "und-US", icu: "_US") {
169175
return Locale.Components(languageRegion: .unitedStates)
@@ -753,7 +759,11 @@ extension LocaleTests {
753759

754760
// TODO: Reenable once (Locale.canonicalIdentifier) is implemented
755761
func test_identifierTypesFromSpecialIdentifier() throws {
762+
#if FIXED_ICU_20187
763+
verify("", cldr: "root", bcp47: "und", icu: "")
764+
#else
756765
verify("", cldr: "root", bcp47: "und", icu: "en_US_POSIX")
766+
#endif
757767
verify("root", cldr: "root", bcp47: "root", icu: "root")
758768
verify("und", cldr: "root", bcp47: "und", icu: "und")
759769

@@ -772,12 +782,20 @@ extension LocaleTests {
772782

773783
// If there's only one component, it is treated as the language code
774784
verify("123", cldr: "root", bcp47: "und", icu: "123")
785+
#if FIXED_ICU_20187
786+
verify("😀123", cldr: "root", bcp47: "und", icu: "")
787+
#else
775788
verify("😀123", cldr: "root", bcp47: "und", icu: "en_US_POSIX")
789+
#endif
776790

777791
// The "_" prefix marks the start of the region
778792
verify("_ZZ", cldr: "und_ZZ", bcp47: "und-ZZ", icu: "_ZZ")
779793
verify("_123", cldr: "und_123", bcp47: "und-123", icu: "_123")
794+
#if FIXED_ICU_20187
795+
verify("_😀123", cldr: "root", bcp47: "und", icu: "")
796+
#else
780797
verify("_😀123", cldr: "root", bcp47: "und", icu: "en_US_POSIX")
798+
#endif
781799

782800
// Starting an ID with script code is an acceptable special case
783801
verify("Hant", cldr: "hant", bcp47: "hant", icu: "hant")

0 commit comments

Comments
 (0)