Skip to content

Commit de5608f

Browse files
authored
Fix duplicated category method issue (#5859)
Currently, we get this linker warning: ``` ld: warning: method '-skipIfUnsupportedPlatformAndReturnError:' in category from /Users/neonacho/Projects/public/swift-package-manager/.build/arm64-apple-macosx/debug/PackageCollectionsTests.build/PackageCollectionsTests.swift.o conflicts with same method from another category ``` since we have two test modules defining the same category methods on `XCTestCase`. To avoid this, we can add a prefix to both implementations.
1 parent 256c682 commit de5608f

11 files changed

+83
-83
lines changed

Tests/PackageCollectionsSigningTests/CertificatePolicyTests.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import XCTest
2020

2121
class CertificatePolicyTests: XCTestCase {
2222
func test_RSA_validate_happyCase() throws {
23-
try skipIfUnsupportedPlatform()
23+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
2424

2525
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
2626
let certPath = fixturePath.appending(components: "Signing", "Test_rsa.cer")
@@ -40,7 +40,7 @@ class CertificatePolicyTests: XCTestCase {
4040
}
4141

4242
func test_EC_validate_happyCase() throws {
43-
try skipIfUnsupportedPlatform()
43+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
4444

4545
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
4646
let certPath = fixturePath.appending(components: "Signing", "Test_ec.cer")
@@ -60,7 +60,7 @@ class CertificatePolicyTests: XCTestCase {
6060
}
6161

6262
func test_validate_untrustedRoot() throws {
63-
try skipIfUnsupportedPlatform()
63+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
6464

6565
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
6666
let certPath = fixturePath.appending(components: "Signing", "Test_rsa.cer")
@@ -91,7 +91,7 @@ class CertificatePolicyTests: XCTestCase {
9191
}
9292

9393
func test_validate_expiredCert() throws {
94-
try skipIfUnsupportedPlatform()
94+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
9595

9696
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
9797
let certPath = fixturePath.appending(components: "Signing", "Test_rsa.cer")
@@ -121,7 +121,7 @@ class CertificatePolicyTests: XCTestCase {
121121
try XCTSkipIf(true)
122122
#endif
123123

124-
try skipIfUnsupportedPlatform()
124+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
125125

126126
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
127127
let certPath = fixturePath.appending(components: "Signing", "development-revoked.cer")
@@ -168,7 +168,7 @@ class CertificatePolicyTests: XCTestCase {
168168
try XCTSkipIf(true)
169169
#endif
170170

171-
try skipIfUnsupportedPlatform()
171+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
172172

173173
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
174174
let certPath = fixturePath.appending(components: "Signing", "development.cer")
@@ -236,7 +236,7 @@ class CertificatePolicyTests: XCTestCase {
236236
try XCTSkipIf(true)
237237
#endif
238238

239-
try skipIfUnsupportedPlatform()
239+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
240240

241241
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
242242
// This must be an Apple Swift Package Collection cert
@@ -305,7 +305,7 @@ class CertificatePolicyTests: XCTestCase {
305305
try XCTSkipIf(true)
306306
#endif
307307

308-
try skipIfUnsupportedPlatform()
308+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
309309

310310
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
311311
// This must be an Apple Distribution cert
@@ -374,7 +374,7 @@ class CertificatePolicyTests: XCTestCase {
374374
try XCTSkipIf(true)
375375
#endif
376376

377-
try skipIfUnsupportedPlatform()
377+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
378378

379379
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
380380
let certPath = fixturePath.appending(components: "Signing", "development.cer")
@@ -449,7 +449,7 @@ class CertificatePolicyTests: XCTestCase {
449449
try XCTSkipIf(true)
450450
#endif
451451

452-
try skipIfUnsupportedPlatform()
452+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
453453

454454
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
455455
// This must be an Apple Swift Package Collection cert
@@ -527,7 +527,7 @@ class CertificatePolicyTests: XCTestCase {
527527
try XCTSkipIf(true)
528528
#endif
529529

530-
try skipIfUnsupportedPlatform()
530+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
531531

532532
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
533533
// This must be an Apple Distribution cert

Tests/PackageCollectionsSigningTests/CertificateTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import TSCBasic
1919

2020
class CertificateTests: XCTestCase {
2121
func test_withRSAKey_fromDER() throws {
22-
try skipIfUnsupportedPlatform()
22+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
2323

2424
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
2525
let path = fixturePath.appending(components: "Signing", "Test_rsa.cer")
@@ -42,7 +42,7 @@ class CertificateTests: XCTestCase {
4242
}
4343

4444
func test_withECKey_fromDER() throws {
45-
try skipIfUnsupportedPlatform()
45+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
4646

4747
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
4848
let path = fixturePath.appending(components: "Signing", "Test_ec.cer")

Tests/PackageCollectionsSigningTests/KeyTests+EC.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import TSCBasic
1919

2020
class ECKeyTests: XCTestCase {
2121
func testPublicKeyFromCertificate() throws {
22-
try skipIfUnsupportedPlatform()
22+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
2323

2424
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
2525
let path = fixturePath.appending(components: "Signing", "Test_ec.cer")
@@ -31,13 +31,13 @@ class ECKeyTests: XCTestCase {
3131
}
3232

3333
func testPublicKeyFromPEM() throws {
34-
try skipIfUnsupportedPlatform()
34+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
3535

3636
XCTAssertNoThrow(try ECPublicKey(pem: ecPublicKey.bytes))
3737
}
3838

3939
func testPrivateKeyFromPEM() throws {
40-
try skipIfUnsupportedPlatform()
40+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
4141

4242
XCTAssertNoThrow(try ECPrivateKey(pem: ecPrivateKey.bytes))
4343
}

Tests/PackageCollectionsSigningTests/KeyTests+RSA.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import TSCBasic
1919

2020
class RSAKeyTests: XCTestCase {
2121
func testPublicKeyFromCertificate() throws {
22-
try skipIfUnsupportedPlatform()
22+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
2323

2424
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
2525
let path = fixturePath.appending(components: "Signing", "Test_rsa.cer")
@@ -31,13 +31,13 @@ class RSAKeyTests: XCTestCase {
3131
}
3232

3333
func testPublicKeyFromPEM() throws {
34-
try skipIfUnsupportedPlatform()
34+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
3535

3636
XCTAssertNoThrow(try RSAPublicKey(pem: rsaPublicKey.bytes))
3737
}
3838

3939
func testPrivateKeyFromPEM() throws {
40-
try skipIfUnsupportedPlatform()
40+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
4141

4242
XCTAssertNoThrow(try RSAPrivateKey(pem: rsaPrivateKey.bytes))
4343
}

Tests/PackageCollectionsSigningTests/PackageCollectionSigningTest.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import XCTest
2121

2222
class PackageCollectionSigningTests: XCTestCase {
2323
func test_RSA_signAndValidate_happyCase() throws {
24-
try skipIfUnsupportedPlatform()
24+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
2525

2626
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
2727
let jsonDecoder = JSONDecoder.makeWithDefaults()
@@ -53,7 +53,7 @@ class PackageCollectionSigningTests: XCTestCase {
5353
}
5454

5555
func test_RSA_signAndValidate_collectionMismatch() throws {
56-
try skipIfUnsupportedPlatform()
56+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
5757

5858
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
5959
let collection1 = PackageCollectionModel.V1.Collection(
@@ -109,7 +109,7 @@ class PackageCollectionSigningTests: XCTestCase {
109109
}
110110

111111
func test_EC_signAndValidate_happyCase() throws {
112-
try skipIfUnsupportedPlatform()
112+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
113113

114114
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
115115
let jsonDecoder = JSONDecoder.makeWithDefaults()
@@ -141,7 +141,7 @@ class PackageCollectionSigningTests: XCTestCase {
141141
}
142142

143143
func test_EC_signAndValidate_collectionMismatch() throws {
144-
try skipIfUnsupportedPlatform()
144+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
145145

146146
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
147147
let collection1 = PackageCollectionModel.V1.Collection(
@@ -202,7 +202,7 @@ class PackageCollectionSigningTests: XCTestCase {
202202
try XCTSkipIf(true)
203203
#endif
204204

205-
try skipIfUnsupportedPlatform()
205+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
206206

207207
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
208208
let jsonDecoder = JSONDecoder.makeWithDefaults()
@@ -311,7 +311,7 @@ class PackageCollectionSigningTests: XCTestCase {
311311
try XCTSkipIf(true)
312312
#endif
313313

314-
try skipIfUnsupportedPlatform()
314+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
315315

316316
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
317317
let jsonDecoder = JSONDecoder.makeWithDefaults()
@@ -405,7 +405,7 @@ class PackageCollectionSigningTests: XCTestCase {
405405
try XCTSkipIf(true)
406406
#endif
407407

408-
try skipIfUnsupportedPlatform()
408+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
409409

410410
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
411411
let jsonDecoder = JSONDecoder.makeWithDefaults()
@@ -499,7 +499,7 @@ class PackageCollectionSigningTests: XCTestCase {
499499
try XCTSkipIf(true)
500500
#endif
501501

502-
try skipIfUnsupportedPlatform()
502+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
503503

504504
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
505505
let jsonDecoder = JSONDecoder.makeWithDefaults()
@@ -553,7 +553,7 @@ class PackageCollectionSigningTests: XCTestCase {
553553
try XCTSkipIf(true)
554554
#endif
555555

556-
try skipIfUnsupportedPlatform()
556+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
557557

558558
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
559559
let jsonDecoder = JSONDecoder.makeWithDefaults()
@@ -618,7 +618,7 @@ class PackageCollectionSigningTests: XCTestCase {
618618
try XCTSkipIf(true)
619619
#endif
620620

621-
try skipIfUnsupportedPlatform()
621+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
622622

623623
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
624624
let jsonDecoder = JSONDecoder.makeWithDefaults()

Tests/PackageCollectionsSigningTests/SignatureTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import TSCBasic
1919

2020
class SignatureTests: XCTestCase {
2121
func test_RS256_generateAndValidate_happyCase() throws {
22-
try skipIfUnsupportedPlatform()
22+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
2323

2424
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
2525
let jsonEncoder = JSONEncoder()
@@ -45,7 +45,7 @@ class SignatureTests: XCTestCase {
4545
}
4646

4747
func test_RS256_generateAndValidate_keyMismatch() throws {
48-
try skipIfUnsupportedPlatform()
48+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
4949

5050
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
5151
let jsonEncoder = JSONEncoder()
@@ -74,7 +74,7 @@ class SignatureTests: XCTestCase {
7474
}
7575

7676
func test_ES256_generateAndValidate_happyCase() throws {
77-
try skipIfUnsupportedPlatform()
77+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
7878

7979
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
8080
let jsonEncoder = JSONEncoder()
@@ -100,7 +100,7 @@ class SignatureTests: XCTestCase {
100100
}
101101

102102
func test_ES256_generateAndValidate_keyMismatch() throws {
103-
try skipIfUnsupportedPlatform()
103+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
104104

105105
try fixture(name: "Collections", createGitRepo: false) { fixturePath in
106106
let jsonEncoder = JSONEncoder()

Tests/PackageCollectionsSigningTests/SigningTests+ECKey.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import XCTest
1717

1818
class ECKeySigningTests: XCTestCase {
1919
func test_signAndValidate_happyCase() throws {
20-
try skipIfUnsupportedPlatform()
20+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
2121

2222
let privateKey = try ECPrivateKey(pem: ecPrivateKey.bytes)
2323
let publicKey = try ECPublicKey(pem: ecPublicKey.bytes)
@@ -28,7 +28,7 @@ class ECKeySigningTests: XCTestCase {
2828
}
2929

3030
func test_signAndValidate_mismatch() throws {
31-
try skipIfUnsupportedPlatform()
31+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
3232

3333
let privateKey = try ECPrivateKey(pem: ecPrivateKey.bytes)
3434
let publicKey = try ECPublicKey(pem: ecPublicKey.bytes)

Tests/PackageCollectionsSigningTests/SigningTests+RSAKey.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import XCTest
1717

1818
class RSAKeySigningTests: XCTestCase {
1919
func test_signAndValidate_happyCase() throws {
20-
try skipIfUnsupportedPlatform()
20+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
2121

2222
let privateKey = try RSAPrivateKey(pem: rsaPrivateKey.bytes)
2323
let publicKey = try RSAPublicKey(pem: rsaPublicKey.bytes)
@@ -28,7 +28,7 @@ class RSAKeySigningTests: XCTestCase {
2828
}
2929

3030
func test_signAndValidate_mismatch() throws {
31-
try skipIfUnsupportedPlatform()
31+
try PackageCollectionsSigningTests_skipIfUnsupportedPlatform()
3232

3333
let privateKey = try RSAPrivateKey(pem: rsaPrivateKey.bytes)
3434
let publicKey = try RSAPublicKey(pem: rsaPublicKey.bytes)

Tests/PackageCollectionsSigningTests/Utilities.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ extension String {
179179
}
180180

181181
extension XCTestCase {
182-
func skipIfUnsupportedPlatform() throws {
182+
func PackageCollectionsSigningTests_skipIfUnsupportedPlatform() throws {
183183
#if os(macOS) || os(Linux) || os(Windows) || os(Android)
184184
#else
185185
throw XCTSkip("Skipping test on unsupported platform")

0 commit comments

Comments
 (0)