Skip to content

Commit 2369930

Browse files
committed
Add FOUNDATION_EXIT_TESTS conditional
1 parent e26190e commit 2369930

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
@@ -74,6 +74,10 @@ let wasiLibcCSettings: [CSetting] = [
7474
.define("_WASI_EMULATED_MMAN", .when(platforms: [.wasi])),
7575
]
7676

77+
let testOnlySwiftSettings: [SwiftSetting] {
78+
.define("FOUNDATION_EXIT_TESTS", .when(platforms: [.macOS, .linux])) // The latest Windows toolchain does not yet have exit tests in swift-testing
79+
}
80+
7781
let package = Package(
7882
name: "swift-foundation",
7983
platforms: [.macOS("15"), .iOS("18"), .tvOS("18"), .watchOS("11")],
@@ -149,7 +153,7 @@ let package = Package(
149153
resources: [
150154
.copy("Resources")
151155
],
152-
swiftSettings: availabilityMacros + featureSettings
156+
swiftSettings: availabilityMacros + featureSettings + testOnlySwiftSettings
153157
),
154158

155159
// FoundationInternationalization
@@ -182,7 +186,7 @@ let package = Package(
182186
"TestSupport",
183187
"FoundationInternationalization",
184188
],
185-
swiftSettings: availabilityMacros + featureSettings
189+
swiftSettings: availabilityMacros + featureSettings + testOnlySwiftSettings
186190
),
187191

188192
// FoundationMacros
@@ -214,7 +218,7 @@ package.targets.append(contentsOf: [
214218
"FoundationMacros",
215219
"TestSupport"
216220
],
217-
swiftSettings: availabilityMacros + featureSettings
221+
swiftSettings: availabilityMacros + featureSettings + testOnlySwiftSettings
218222
)
219223
])
220224
#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)