Skip to content

Commit 367d361

Browse files
committed
More explicit test arguments
1 parent fb51a42 commit 367d361

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

Tests/PackageRegistryTests/RegistryClientTests.swift

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,8 +1190,12 @@ fileprivate var availabilityURL = URL("\(registryURL)/availability")
11901190
}
11911191

11921192
@Suite("Manifest Content") struct ManifestContent {
1193-
@Test(arguments: [ToolsVersion.v5_3, .v4, nil])
1194-
func getManifestContent(toolsVersion: ToolsVersion?) async throws {
1193+
@Test(arguments: [
1194+
(toolsVersion: ToolsVersion.v5_3, expectedToolsVersion: ToolsVersion.v5_3),
1195+
(toolsVersion: ToolsVersion.v4, expectedToolsVersion: ToolsVersion.v4),
1196+
(toolsVersion: nil, expectedToolsVersion: ToolsVersion.current)
1197+
])
1198+
func getManifestContent(toolsVersion: ToolsVersion?, expectedToolsVersion: ToolsVersion) async throws {
11951199
let checksumAlgorithm: HashAlgorithm = MockHashAlgorithm()
11961200
let checksum = checksumAlgorithm.hash(emptyZipFile).hexadecimalRepresentation
11971201

@@ -1282,7 +1286,7 @@ fileprivate var availabilityURL = URL("\(registryURL)/availability")
12821286
customToolsVersion: toolsVersion
12831287
)
12841288
let parsedToolsVersion = try ToolsVersionParser.parse(utf8String: manifest)
1285-
#expect(parsedToolsVersion == toolsVersion ?? .current)
1289+
#expect(parsedToolsVersion == expectedToolsVersion)
12861290
}
12871291

12881292
do {
@@ -1296,12 +1300,15 @@ fileprivate var availabilityURL = URL("\(registryURL)/availability")
12961300
) { continuation.resume(with: $0) }
12971301
}
12981302
let parsedToolsVersion = try ToolsVersionParser.parse(utf8String: manifestSync)
1299-
#expect(parsedToolsVersion == toolsVersion ?? .current)
1303+
#expect(parsedToolsVersion == expectedToolsVersion)
13001304
}
13011305
}
13021306

1303-
@Test(arguments: [ToolsVersion.v5_3, nil])
1304-
func getManifestContentWithOptionalContentVersion(toolsVersion: ToolsVersion?) async throws {
1307+
@Test(arguments: [
1308+
(toolsVersion: ToolsVersion.v5_3, expectedToolsVersion: ToolsVersion.v5_3),
1309+
(toolsVersion: nil, expectedToolsVersion: ToolsVersion.current)
1310+
])
1311+
func getManifestContentWithOptionalContentVersion(toolsVersion: ToolsVersion?, expectedToolsVersion: ToolsVersion) async throws {
13051312
let checksumAlgorithm: HashAlgorithm = MockHashAlgorithm()
13061313
let checksum = checksumAlgorithm.hash(emptyZipFile).hexadecimalRepresentation
13071314

@@ -1392,12 +1399,15 @@ fileprivate var availabilityURL = URL("\(registryURL)/availability")
13921399
customToolsVersion: toolsVersion
13931400
)
13941401
let parsedToolsVersion = try ToolsVersionParser.parse(utf8String: manifest)
1395-
#expect(parsedToolsVersion == toolsVersion ?? .current)
1402+
#expect(parsedToolsVersion == expectedToolsVersion)
13961403
}
13971404
}
13981405

1399-
@Test(arguments: [ToolsVersion.v5_3, nil])
1400-
func getManifestContentMatchingChecksumInStorage(toolsVersion: ToolsVersion?) async throws {
1406+
@Test(arguments: [
1407+
(toolsVersion: ToolsVersion.v5_3, expectedToolsVersion: ToolsVersion.v5_3),
1408+
(toolsVersion: nil, expectedToolsVersion: ToolsVersion.current)
1409+
])
1410+
func getManifestContentMatchingChecksumInStorage(toolsVersion: ToolsVersion?, expectedToolsVersion: ToolsVersion) async throws {
14011411
let checksumAlgorithm: HashAlgorithm = MockHashAlgorithm()
14021412
let checksum = checksumAlgorithm.hash(emptyZipFile).hexadecimalRepresentation
14031413

@@ -1507,7 +1517,7 @@ fileprivate var availabilityURL = URL("\(registryURL)/availability")
15071517
customToolsVersion: toolsVersion
15081518
)
15091519
let parsedToolsVersion = try ToolsVersionParser.parse(utf8String: manifest)
1510-
#expect(parsedToolsVersion == toolsVersion ?? .current)
1520+
#expect(parsedToolsVersion == expectedToolsVersion)
15111521
}
15121522
}
15131523

@@ -1625,8 +1635,11 @@ fileprivate var availabilityURL = URL("\(registryURL)/availability")
16251635
}
16261636
}
16271637

1628-
@Test(arguments: [ToolsVersion.v5_3, nil])
1629-
func getManifestContentWithNonMatchingChecksumInStorage_warn(toolsVersion: ToolsVersion?) async throws {
1638+
@Test(arguments: [
1639+
(toolsVersion: ToolsVersion.v5_3, expectedToolsVersion: ToolsVersion.v5_3),
1640+
(toolsVersion: nil, expectedToolsVersion: ToolsVersion.current)
1641+
])
1642+
func getManifestContentWithNonMatchingChecksumInStorage_warn(toolsVersion: ToolsVersion?, expectedToolsVersion: ToolsVersion) async throws {
16301643
let checksumAlgorithm: HashAlgorithm = MockHashAlgorithm()
16311644
let checksum = checksumAlgorithm.hash(emptyZipFile).hexadecimalRepresentation
16321645

@@ -1742,7 +1755,7 @@ fileprivate var availabilityURL = URL("\(registryURL)/availability")
17421755
}
17431756

17441757
let parsedToolsVersion = try ToolsVersionParser.parse(utf8String: manifest)
1745-
#expect(parsedToolsVersion == toolsVersion ?? .current)
1758+
#expect(parsedToolsVersion == expectedToolsVersion)
17461759
}
17471760
}
17481761

0 commit comments

Comments
 (0)