Skip to content

Commit 152798f

Browse files
Merge pull request #3359 from SwiftPackageIndex/fix-xcode-15-test-crashes
Fix crashes in Xcode 15
2 parents ae3500d + 5ff0946 commit 152798f

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

Tests/AppTests/PackageCollectionControllerTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,11 @@ class PackageCollectionControllerTests: AppTestCase {
5858
summary: "summary 1").create(on: app.db)
5959

6060
// MUT
61+
let encoder = self.encoder
6162
try await app.test(
6263
.GET,
6364
"foo/collection.json",
64-
afterResponse: { res async throws in
65+
afterResponse: { @MainActor res async throws in
6566
// validation
6667
XCTAssertEqual(res.status, .ok)
6768
let json = try res.content.decode(PackageCollection.self)

Tests/AppTests/PackageCollectionTests.swift

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,13 @@ class PackageCollectionTests: AppTestCase {
370370
keywords: ["key", "word"],
371371
overview: "overview")
372372

373-
// validate
373+
#if compiler(<6)
374+
await MainActor.run { // validate
375+
assertSnapshot(of: res, as: .json(encoder))
376+
}
377+
#else
374378
assertSnapshot(of: res, as: .json(encoder))
379+
#endif
375380
}
376381

377382
func test_generate_from_urls_noResults() async throws {
@@ -467,8 +472,13 @@ class PackageCollectionTests: AppTestCase {
467472
authorName: "Foo",
468473
keywords: ["key", "word"])
469474

470-
// validate
475+
#if compiler(<6)
476+
await MainActor.run { // validate
477+
assertSnapshot(of: res, as: .json(encoder))
478+
}
479+
#else
471480
assertSnapshot(of: res, as: .json(encoder))
481+
#endif
472482
}
473483

474484
func test_generate_for_owner_noResults() async throws {
@@ -768,7 +778,13 @@ class PackageCollectionTests: AppTestCase {
768778

769779
// validate signed collection content
770780
XCTAssertFalse(signedCollection.signature.signature.isEmpty)
781+
#if compiler(<6)
782+
await MainActor.run {
783+
assertSnapshot(of: signedCollection, as: .json(encoder))
784+
}
785+
#else
771786
assertSnapshot(of: signedCollection, as: .json(encoder))
787+
#endif
772788

773789
// validate signature
774790
let validated = try await SignedCollection.validate(signedCollection: signedCollection)

0 commit comments

Comments
 (0)