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