Skip to content

Commit f22ad17

Browse files
author
Will Paceley
committed
Fix inverted logic in the Info.plist key URL reachability check
When CHECK_INFOPLIST_KEY_URL_REACHABILITY is set, the check collected the URLs that returned HTTP 200 and recorded those as unreachable, and threw on the first non-200 so the remaining URLs were never checked. Collect only the URLs that fail to return HTTP 200, without aborting on the first failure, so the test reports the URLs that are actually unreachable.
1 parent 4c68275 commit f22ad17

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Tests/SWBCoreTests/SpecRegistryTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ import SWBUtil
313313
let unreachableURLs: [(String, String)]
314314
#if canImport(Darwin)
315315
if checkInfoPlistKeyURLReachability {
316-
unreachableURLs = try await withThrowingTaskGroup(of: (String, String).self) { group in
316+
unreachableURLs = try await withThrowingTaskGroup(of: (String, String)?.self) { group in
317317
for keyName in Set(infoPlistKeyOptions.map({ $0.name.hasPrefix("INFOPLIST_KEY_") ? String($0.name.dropFirst("INFOPLIST_KEY_".count)) : (legacyKeyMappings[$0.name] ?? $0.name) })).sorted() {
318318
switch keyName {
319319
case "UISupportedInterfaceOrientations_iPhone", "UISupportedInterfaceOrientations_iPad":
@@ -337,14 +337,14 @@ import SWBUtil
337337
group.addTask {
338338
let (_, response) = try await URLSession.shared.data(from: #require(URL(string: url)))
339339
guard let response = response as? HTTPURLResponse, response.statusCode == 200 else {
340-
throw StubError.error("Network failure")
340+
return (String(keyName), url)
341341
}
342342

343-
return (String(keyName), url)
343+
return nil
344344
}
345345
}
346346

347-
return try await group.collect()
347+
return try await group.collect().compactMap { $0 }
348348
}
349349
} else {
350350
unreachableURLs = []

0 commit comments

Comments
 (0)