1313//===----------------------------------------------------------------------===//
1414
1515import CryptoKit
16+ import Foundation
1617import SwiftASN1
18+ import Testing
1719@testable import X509
18- import XCTest
1920
20- final class CustomPrivateKeyTests : XCTestCase {
21+ @Suite
22+ final class CustomPrivateKeyTests {
2123
24+ @Test ( " CustomPrivateKey Backing Properties " )
2225 func testCustomPrivateKeyBackingProperties( ) {
2326 let keyBacking = TestAsyncKey ( )
2427 let privateKey = Certificate . PrivateKey ( keyBacking)
25- XCTAssertEqual ( privateKey. publicKey, keyBacking. publicKey)
26- XCTAssertEqual ( privateKey. description, " CustomPrivateKey " )
27- XCTAssertEqual ( keyBacking. hashValue, privateKey. hashValue)
28- XCTAssertEqual ( keyBacking. defaultSignatureAlgorithm, privateKey. defaultSignatureAlgorithm)
28+ #expect ( privateKey. publicKey == keyBacking. publicKey)
29+ #expect ( privateKey. description == " CustomPrivateKey " )
30+ #expect ( keyBacking. hashValue == privateKey. hashValue)
31+ #expect ( keyBacking. defaultSignatureAlgorithm == privateKey. defaultSignatureAlgorithm)
2932 }
3033
3134 func testCustomPrivateKeySigning( ) async throws {
@@ -35,24 +38,26 @@ final class CustomPrivateKeyTests: XCTestCase {
3538 bytes: Data ( ) ,
3639 signatureAlgorithm: . ecdsaWithSHA256
3740 )
38- XCTAssertThrowsError (
41+ #expect ( throws : TestAsyncKey . MyError . self ) {
3942 try privateKey. sign (
4043 bytes: Data ( ) ,
4144 signatureAlgorithm: . ecdsaWithSHA256
4245 )
43- )
46+ }
4447 }
4548
4649 func testCustomPrivateKeyBackingEquality( ) {
4750 let keyBacking = TestAsyncKey ( )
4851 let leftKey = Certificate . PrivateKey ( keyBacking)
4952 let rightKey = Certificate . PrivateKey ( keyBacking)
50- XCTAssertEqual ( leftKey, rightKey)
53+ #expect ( leftKey == rightKey)
5154 }
5255
5356 func testCustomPrivateKeySerialization( ) {
5457 let privateKey = Certificate . PrivateKey ( TestAsyncKey ( ) )
55- XCTAssertThrowsError ( try privateKey. serializeAsPEM ( ) )
58+ #expect( throws: TestAsyncKey . MyError. self) {
59+ try privateKey. serializeAsPEM ( )
60+ }
5661 }
5762
5863}
0 commit comments