Format code with SwiftFormat automatically in every build
This commit is contained in:
parent
f167ab7549
commit
7f9f0e43b2
100 changed files with 1124 additions and 1063 deletions
|
|
@ -8,11 +8,11 @@
|
|||
|
||||
import XCTest
|
||||
|
||||
// swiftformat:disable:next sortedImports
|
||||
@testable import passKit
|
||||
@testable import Crypto
|
||||
|
||||
class CryptoFrameworkTest: XCTestCase {
|
||||
|
||||
typealias MessageConverter = (CryptoPGPMessage, NSErrorPointer) -> CryptoPGPMessage?
|
||||
|
||||
private let testText = "Hello World!"
|
||||
|
|
@ -47,7 +47,7 @@ class CryptoFrameworkTest: XCTestCase {
|
|||
].forEach { testKeyInfo in
|
||||
var error: NSError?
|
||||
guard let publicKey = CryptoNewKeyFromArmored(testKeyInfo.publicKey, &error),
|
||||
let privateKey = CryptoNewKeyFromArmored(testKeyInfo.privateKey, &error) else {
|
||||
let privateKey = CryptoNewKeyFromArmored(testKeyInfo.privateKey, &error) else {
|
||||
XCTFail("Keys cannot be initialized.")
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
// Copyright © 2019 Bob Sun. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import SwiftyUserDefaults
|
||||
import XCTest
|
||||
|
||||
@testable import passKit
|
||||
|
||||
|
|
@ -144,17 +144,17 @@ class PGPAgentTest: XCTestCase {
|
|||
passphraseRequestCalledCount += 1
|
||||
return "incorrect passphrase"
|
||||
}
|
||||
|
||||
|
||||
// Provide the correct passphrase.
|
||||
XCTAssertEqual(try basicEncryptDecrypt(using: pgpAgent, keyID: RSA2048.fingerprint, requestPassphrase: provideCorrectPassphrase), testData)
|
||||
XCTAssertEqual(passphraseRequestCalledCount, 1)
|
||||
|
||||
|
||||
// Provide the wrong passphrase.
|
||||
XCTAssertThrowsError(try basicEncryptDecrypt(using: pgpAgent, keyID: RSA2048.fingerprint, requestPassphrase: provideIncorrectPassphrase)) {
|
||||
XCTAssertEqual($0 as! AppError, AppError.WrongPassphrase)
|
||||
}
|
||||
XCTAssertEqual(passphraseRequestCalledCount, 2)
|
||||
|
||||
|
||||
// Ask for the passphrase because the previous decryption has failed.
|
||||
XCTAssertEqual(try basicEncryptDecrypt(using: pgpAgent, keyID: RSA2048.fingerprint, requestPassphrase: provideCorrectPassphrase), testData)
|
||||
XCTAssertEqual(passphraseRequestCalledCount, 3)
|
||||
|
|
@ -165,4 +165,3 @@ class PGPAgentTest: XCTestCase {
|
|||
try KeyFileManager(keyType: PgpKey.PRIVATE, keyPath: "", keyHandler: keychain.add).importKey(from: privateKey)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue