@@ -2165,36 +2165,35 @@ extension FormatStylePatternMatchingTests {
2165
2165
#if FOUNDATION_FRAMEWORK
2166
2166
extension NumberFormatStyleTests {
2167
2167
@Test func formattedLeadingDotSyntax( ) async {
2168
- await usingCurrentInternationalizationPreferences {
2169
- let integer = 12345
2170
- #expect( integer. formatted ( . number) == integer. formatted ( IntegerFormatStyle . number) )
2171
- #expect( integer. formatted ( . percent) == integer. formatted ( IntegerFormatStyle . Percent. percent) )
2172
- #expect( integer. formatted ( . currency( code: " usd " ) ) == integer. formatted ( IntegerFormatStyle . Currency. currency ( code: " usd " ) ) )
2173
-
2174
- let double = 1.2345
2175
- #expect( double. formatted ( . number) == double. formatted ( FloatingPointFormatStyle . number) )
2176
- #expect( double. formatted ( . percent) == double. formatted ( FloatingPointFormatStyle . Percent. percent) )
2177
- #expect( double. formatted ( . currency( code: " usd " ) ) == double. formatted ( FloatingPointFormatStyle . Currency. currency ( code: " usd " ) ) )
2178
-
2179
-
2180
- func parseableFunc< Style: ParseableFormatStyle > ( _ value: Style . FormatInput , style: Style ) -> Style { style }
2181
-
2182
- #expect( parseableFunc ( UInt8 ( ) , style: . number) == parseableFunc ( UInt8 ( ) , style: IntegerFormatStyle . number) )
2183
- #expect( parseableFunc ( Int16 ( ) , style: . percent) == parseableFunc ( Int16 ( ) , style: IntegerFormatStyle . Percent. percent) )
2184
- #expect( parseableFunc ( Int ( ) , style: . currency( code: " usd " ) ) == parseableFunc ( Int ( ) , style: IntegerFormatStyle . Currency. currency ( code: " usd " ) ) )
2185
-
2186
- #expect( parseableFunc ( Float ( ) , style: . number) == parseableFunc ( Float ( ) , style: FloatingPointFormatStyle . number) )
2187
- #expect( parseableFunc ( Double ( ) , style: . percent) == parseableFunc ( Double ( ) , style: FloatingPointFormatStyle . Percent. percent) )
2188
- #expect( parseableFunc ( CGFloat ( ) , style: . currency( code: " usd " ) ) == parseableFunc ( CGFloat ( ) , style: FloatingPointFormatStyle . Currency. currency ( code: " usd " ) ) )
2189
-
2190
- #expect( parseableFunc ( Decimal ( ) , style: . number) == parseableFunc ( Decimal ( ) , style: Decimal . FormatStyle. number) )
2191
- #expect( parseableFunc ( Decimal ( ) , style: . percent) == parseableFunc ( Decimal ( ) , style: Decimal . FormatStyle. Percent. percent) )
2192
- #expect( parseableFunc ( Decimal ( ) , style: . currency( code: " usd " ) ) == parseableFunc ( Decimal ( ) , style: Decimal . FormatStyle. Currency. currency ( code: " usd " ) ) )
2193
-
2194
- struct GenericWrapper < V> { }
2195
- func parseableWrapperFunc< Style: ParseableFormatStyle > ( _ value: GenericWrapper < Style . FormatInput > , style: Style ) -> Style { style }
2196
- #expect( parseableWrapperFunc ( GenericWrapper < Double > ( ) , style: . number) == parseableWrapperFunc ( GenericWrapper < Double > ( ) , style: FloatingPointFormatStyle . number) )
2197
- }
2168
+ let locale = Locale ( identifier: " ja_JP " )
2169
+ let integer = 12345
2170
+ #expect( integer. formatted ( . number. locale ( locale) ) == integer. formatted ( IntegerFormatStyle . number. locale ( locale) ) )
2171
+ #expect( integer. formatted ( . percent. locale ( locale) ) == integer. formatted ( IntegerFormatStyle . Percent. percent. locale ( locale) ) )
2172
+ #expect( integer. formatted ( . currency( code: " usd " ) . locale ( locale) ) == integer. formatted ( IntegerFormatStyle . Currency. currency ( code: " usd " ) . locale ( locale) ) )
2173
+
2174
+ let double = 1.2345
2175
+ #expect( double. formatted ( . number. locale ( locale) ) == double. formatted ( FloatingPointFormatStyle . number. locale ( locale) ) )
2176
+ #expect( double. formatted ( . percent. locale ( locale) ) == double. formatted ( FloatingPointFormatStyle . Percent. percent. locale ( locale) ) )
2177
+ #expect( double. formatted ( . currency( code: " usd " ) . locale ( locale) ) == double. formatted ( FloatingPointFormatStyle . Currency. currency ( code: " usd " ) . locale ( locale) ) )
2178
+
2179
+
2180
+ func parseableFunc< Style: ParseableFormatStyle > ( _ value: Style . FormatInput , style: Style ) -> Style { style }
2181
+
2182
+ #expect( parseableFunc ( UInt8 ( ) , style: . number. locale ( locale) ) == parseableFunc ( UInt8 ( ) , style: IntegerFormatStyle . number. locale ( locale) ) )
2183
+ #expect( parseableFunc ( Int16 ( ) , style: . percent. locale ( locale) ) == parseableFunc ( Int16 ( ) , style: IntegerFormatStyle . Percent. percent. locale ( locale) ) )
2184
+ #expect( parseableFunc ( Int ( ) , style: . currency( code: " usd " ) . locale ( locale) ) == parseableFunc ( Int ( ) , style: IntegerFormatStyle . Currency. currency ( code: " usd " ) . locale ( locale) ) )
2185
+
2186
+ #expect( parseableFunc ( Float ( ) , style: . number. locale ( locale) ) == parseableFunc ( Float ( ) , style: FloatingPointFormatStyle . number. locale ( locale) ) )
2187
+ #expect( parseableFunc ( Double ( ) , style: . percent. locale ( locale) ) == parseableFunc ( Double ( ) , style: FloatingPointFormatStyle . Percent. percent. locale ( locale) ) )
2188
+ #expect( parseableFunc ( CGFloat ( ) , style: . currency( code: " usd " ) . locale ( locale) ) == parseableFunc ( CGFloat ( ) , style: FloatingPointFormatStyle . Currency. currency ( code: " usd " ) . locale ( locale) ) )
2189
+
2190
+ #expect( parseableFunc ( Decimal ( ) , style: . number. locale ( locale) ) == parseableFunc ( Decimal ( ) , style: Decimal . FormatStyle. number. locale ( locale) ) )
2191
+ #expect( parseableFunc ( Decimal ( ) , style: . percent. locale ( locale) ) == parseableFunc ( Decimal ( ) , style: Decimal . FormatStyle. Percent. percent. locale ( locale) ) )
2192
+ #expect( parseableFunc ( Decimal ( ) , style: . currency( code: " usd " ) . locale ( locale) ) == parseableFunc ( Decimal ( ) , style: Decimal . FormatStyle. Currency. currency ( code: " usd " ) . locale ( locale) ) )
2193
+
2194
+ struct GenericWrapper < V> { }
2195
+ func parseableWrapperFunc< Style: ParseableFormatStyle > ( _ value: GenericWrapper < Style . FormatInput > , style: Style ) -> Style { style }
2196
+ #expect( parseableWrapperFunc ( GenericWrapper < Double > ( ) , style: . number. locale ( locale) ) == parseableWrapperFunc ( GenericWrapper < Double > ( ) , style: FloatingPointFormatStyle . number. locale ( locale) ) )
2198
2197
}
2199
2198
}
2200
2199
#endif
0 commit comments