Skip to content

Commit 5967832

Browse files
committed
Add FOUNDATION_EXIT_TESTS conditional
1 parent 4b61751 commit 5967832

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

Package.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ let wasiLibcCSettings: [CSetting] = [
7575
.define("_WASI_EMULATED_MMAN", .when(platforms: [.wasi])),
7676
]
7777

78+
let testOnlySwiftSettings: [SwiftSetting] {
79+
.define("FOUNDATION_EXIT_TESTS", .when(platforms: [.macOS, .linux, .openBSD])) // The latest Windows toolchain does not yet have exit tests in swift-testing
80+
}
81+
7882
let package = Package(
7983
name: "swift-foundation",
8084
platforms: [.macOS("15"), .iOS("18"), .tvOS("18"), .watchOS("11")],
@@ -171,7 +175,7 @@ let package = Package(
171175
"LifetimeDependenceMutableAccessors",
172176
.when(platforms: [.macOS, .iOS, .watchOS, .tvOS, .linux])
173177
),
174-
] + availabilityMacros + featureSettings
178+
] + availabilityMacros + featureSettings + testOnlySwiftSettings
175179
),
176180

177181
// FoundationInternationalization
@@ -204,7 +208,7 @@ let package = Package(
204208
"TestSupport",
205209
"FoundationInternationalization",
206210
],
207-
swiftSettings: availabilityMacros + featureSettings
211+
swiftSettings: availabilityMacros + featureSettings + testOnlySwiftSettings
208212
),
209213

210214
// FoundationMacros
@@ -236,7 +240,7 @@ package.targets.append(contentsOf: [
236240
"FoundationMacros",
237241
"TestSupport"
238242
],
239-
swiftSettings: availabilityMacros + featureSettings
243+
swiftSettings: availabilityMacros + featureSettings + testOnlySwiftSettings
240244
)
241245
])
242246
#endif

Tests/FoundationEssentialsTests/AttributedString/AttributedStringIndexTrackingTests.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ private struct AttributedStringIndexTrackingTests {
173173
#expect(String(text[helloRange].characters) == "He")
174174
}
175175

176+
#if FOUNDATION_EXIT_TESTS
176177
@Test
177178
func trackingLostPreconditions() async {
178179
await #expect(processExitsWith: .failure) {
@@ -207,6 +208,7 @@ private struct AttributedStringIndexTrackingTests {
207208
}
208209
}
209210
}
211+
#endif
210212

211213
@Test
212214
func trackingLost() throws {
@@ -261,6 +263,7 @@ private struct AttributedStringIndexTrackingTests {
261263
#expect(AttributedString(text[updatedRanges[1]]) == original[worldRange].settingAttributes(AttributeContainer.testInt(2)))
262264
}
263265

266+
#if FOUNDATION_EXIT_TESTS
264267
@Test
265268
func invalidInputRanges() async {
266269
await #expect(processExitsWith: .failure) {
@@ -288,4 +291,5 @@ private struct AttributedStringIndexTrackingTests {
288291
}
289292
}
290293
}
294+
#endif
291295
}

0 commit comments

Comments
 (0)