Skip to content

Commit fb51a42

Browse files
committed
Address feedback
1 parent 3f2f83c commit fb51a42

File tree

1 file changed

+7
-20
lines changed

1 file changed

+7
-20
lines changed

Tests/PackageRegistryTests/RegistryClientTests.swift

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -267,14 +267,10 @@ fileprivate var availabilityURL = URL("\(registryURL)/availability")
267267
configuration.defaultRegistry = Registry(url: registryURL, supportsAvailability: false)
268268

269269
let registryClient = makeRegistryClient(configuration: configuration, httpClient: httpClient)
270+
270271
task = Task {
271-
do {
272-
_ = try await registryClient.getPackageMetadata(package: identity)
273-
Issue.record("Task completed without being cancelled")
274-
} catch let error where error is _Concurrency.CancellationError {
275-
// OK
276-
} catch {
277-
Issue.record("Task failed with unexpected error: \(error)")
272+
await #expect(throws: _Concurrency.CancellationError.self) {
273+
try await registryClient.getPackageMetadata(package: identity)
278274
}
279275
}
280276

@@ -1304,7 +1300,8 @@ fileprivate var availabilityURL = URL("\(registryURL)/availability")
13041300
}
13051301
}
13061302

1307-
@Test func getManifestContentWithOptionalContentVersion() async throws {
1303+
@Test(arguments: [ToolsVersion.v5_3, nil])
1304+
func getManifestContentWithOptionalContentVersion(toolsVersion: ToolsVersion?) async throws {
13081305
let checksumAlgorithm: HashAlgorithm = MockHashAlgorithm()
13091306
let checksum = checksumAlgorithm.hash(emptyZipFile).hexadecimalRepresentation
13101307

@@ -1392,20 +1389,10 @@ fileprivate var availabilityURL = URL("\(registryURL)/availability")
13921389
let manifest = try await registryClient.getManifestContent(
13931390
package: identity,
13941391
version: version,
1395-
customToolsVersion: nil
1396-
)
1397-
let parsedToolsVersion = try ToolsVersionParser.parse(utf8String: manifest)
1398-
#expect(parsedToolsVersion == .current)
1399-
}
1400-
1401-
do {
1402-
let manifest = try await registryClient.getManifestContent(
1403-
package: identity,
1404-
version: version,
1405-
customToolsVersion: .v5_3
1392+
customToolsVersion: toolsVersion
14061393
)
14071394
let parsedToolsVersion = try ToolsVersionParser.parse(utf8String: manifest)
1408-
#expect(parsedToolsVersion == .v5_3)
1395+
#expect(parsedToolsVersion == toolsVersion ?? .current)
14091396
}
14101397
}
14111398

0 commit comments

Comments
 (0)