Skip to content

Commit ebb9db4

Browse files
committed
Remove some unused locale code
And fixup availability for x86 that was copied from another branch.
1 parent 37dad18 commit ebb9db4

File tree

1 file changed

+11
-24
lines changed

1 file changed

+11
-24
lines changed

test/stdlib/PrintFloat16.swift

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %target-run-simple-swift
22
// REQUIRES: executable_test
3+
// UNSUPPORTED: use_os_stdlib
34

45
// rdar://77087867
56
// UNSUPPORTED: CPU=arm64_32 && OS=watchos
@@ -10,31 +11,19 @@
1011
import StdlibUnittest
1112

1213
let PrintTests = TestSuite("FloatingPointPrinting")
13-
//
14-
// // An earlier version of Swift's floating-point `.description` logic
15-
// // used potentially locale-sensitive C library functions, hence
16-
// // this logic to help verify that the output does not depend on
17-
// // the C locale.
18-
// PrintTests.setUp {
19-
// if let localeArgIndex = CommandLine.arguments.firstIndex(of: "--locale") {
20-
// let locale = CommandLine.arguments[localeArgIndex + 1]
21-
// expectEqual("ru_RU.UTF-8", locale)
22-
// setlocale(LC_ALL, locale)
23-
// } else {
24-
// setlocale(LC_ALL, "")
25-
// }
26-
// }
2714

2815
// Check that all floating point types
2916
// are CustomStringConvertible
3017
PrintTests.test("CustomStringConvertible") {
3118
func hasDescription(_ any: Any) {
3219
expectTrue(any is CustomStringConvertible)
3320
}
34-
if #available(SwiftStdlib 6.0, *) {
21+
#if !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))
22+
if #available(SwiftStdlib 5.3, *) {
3523
hasDescription(Float16(1.0))
3624
hasDescription(CFloat16(1.0))
3725
}
26+
#endif
3827
hasDescription(Float(1.0))
3928
hasDescription(Double(1.0))
4029
#if !os(Windows) && (arch(i386) || arch(x86_64))
@@ -50,10 +39,12 @@ PrintTests.test("CustomDebugStringConvertible") {
5039
func hasDebugDescription(_ any: Any) {
5140
expectTrue(any is CustomDebugStringConvertible)
5241
}
53-
if #available(SwiftStdlib 6.0, *) {
42+
#if !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))
43+
if #available(SwiftStdlib 5.3, *) {
5444
hasDebugDescription(Float16(1.0))
5545
hasDebugDescription(CFloat16(1.0))
5646
}
47+
#endif
5748
hasDebugDescription(Float(1.0))
5849
hasDebugDescription(Double(1.0))
5950
#if !os(Windows) && (arch(i386) || arch(x86_64))
@@ -63,11 +54,8 @@ PrintTests.test("CustomDebugStringConvertible") {
6354
hasDebugDescription(CDouble(1.0))
6455
}
6556

66-
#if (os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64)
67-
@available(SwiftStdlib 6.0, *) // Float16/intel
68-
#else
57+
#if !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))
6958
@available(SwiftStdlib 5.8, *) // Regex
70-
#endif
7159
func testFinite(_ bitPattern: UInt16) {
7260
let value = Float16(bitPattern: bitPattern)
7361
let string = value.description
@@ -124,13 +112,11 @@ func testFinite(_ bitPattern: UInt16) {
124112
)
125113
}
126114
}
115+
#endif
127116

128117
PrintTests.test("Printable_Float16") {
129-
#if (os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64)
130-
guard #available(SwiftStdlib 6.0, *) else { return } // Float16/intel
131-
#else
118+
#if !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))
132119
guard #available(SwiftStdlib 5.8, *) else { return } // Regex
133-
#endif
134120
for bitPattern in UInt16.zero ..< 0x7c00 {
135121
testFinite(bitPattern)
136122
testFinite(0x8000 | bitPattern)
@@ -158,6 +144,7 @@ PrintTests.test("Printable_Float16") {
158144
expectEqual(Float16(bitPattern: bitPattern).debugDescription, expected)
159145
expectEqual(Float16(bitPattern: 0x8000 | bitPattern).debugDescription, "-\(expected)")
160146
}
147+
#endif
161148
}
162149

163150
runAllTests()

0 commit comments

Comments
 (0)