@@ -430,24 +430,21 @@ private struct NumberExtensionParseStrategyTests {
430430 }
431431
432432 @Test func decimal_withFormat_localeDependent( ) throws {
433- guard Locale . autoupdatingCurrent. identifier == " en_US " else {
434- print ( " Your current locale is \( Locale . autoupdatingCurrent) . Set it to en_US to run this test " )
435- return
436- }
437- #expect( try Decimal ( " -3,000.14159 " , format: . number) == Decimal ( - 3000.14159 ) )
438- #expect( try Decimal ( " -3.14159 " , format: . number) == Decimal ( - 3.14159 ) )
439- #expect( try Decimal ( " 12,345.678 " , format: . number) == Decimal ( 12345.678 ) )
440- #expect( try Decimal ( " 0.00 " , format: . number) == 0 )
441-
442- #expect( try Decimal ( " -3,000.14159% " , format: . percent) == Decimal ( - 30.0014159 ) )
443- #expect( try Decimal ( " -314.159% " , format: . percent) == Decimal ( - 3.14159 ) )
444- #expect( try Decimal ( " 12,345.678% " , format: . percent) == Decimal ( 123.45678 ) )
445- #expect( try Decimal ( " 0.00% " , format: . percent) == 0 )
446-
447- #expect( try Decimal ( " $12,345.00 " , format: . currency( code: " USD " ) ) == Decimal ( 12345 ) )
448- #expect( try Decimal ( " $12345.68 " , format: . currency( code: " USD " ) ) == Decimal ( 12345.68 ) )
449- #expect( try Decimal ( " $0.00 " , format: . currency( code: " USD " ) ) == Decimal ( 0 ) )
450- #expect( try Decimal ( " -$3000.0000014 " , format: . currency( code: " USD " ) ) == Decimal ( string: " -3000.0000014 " ) !)
433+ let locale = Locale ( identifier: " en_US " )
434+ #expect( try Decimal ( " -3,000.14159 " , format: . number. locale ( locale) ) == Decimal ( - 3000.14159 ) )
435+ #expect( try Decimal ( " -3.14159 " , format: . number. locale ( locale) ) == Decimal ( - 3.14159 ) )
436+ #expect( try Decimal ( " 12,345.678 " , format: . number. locale ( locale) ) == Decimal ( 12345.678 ) )
437+ #expect( try Decimal ( " 0.00 " , format: . number. locale ( locale) ) == 0 )
438+
439+ #expect( try Decimal ( " -3,000.14159% " , format: . percent. locale ( locale) ) == Decimal ( - 30.0014159 ) )
440+ #expect( try Decimal ( " -314.159% " , format: . percent. locale ( locale) ) == Decimal ( - 3.14159 ) )
441+ #expect( try Decimal ( " 12,345.678% " , format: . percent. locale ( locale) ) == Decimal ( 123.45678 ) )
442+ #expect( try Decimal ( " 0.00% " , format: . percent. locale ( locale) ) == 0 )
443+
444+ #expect( try Decimal ( " $12,345.00 " , format: . currency( code: " USD " ) . locale ( locale) ) == Decimal ( 12345 ) )
445+ #expect( try Decimal ( " $12345.68 " , format: . currency( code: " USD " ) . locale ( locale) ) == Decimal ( 12345.68 ) )
446+ #expect( try Decimal ( " $0.00 " , format: . currency( code: " USD " ) . locale ( locale) ) == Decimal ( 0 ) )
447+ #expect( try Decimal ( " -$3000.0000014 " , format: . currency( code: " USD " ) . locale ( locale) ) == Decimal ( string: " -3000.0000014 " ) !)
451448 }
452449}
453450
0 commit comments