Fix the QRKeyScanner issue on reading footer
This commit is contained in:
parent
1e1d6f0f44
commit
87d1dd5be1
2 changed files with 8 additions and 1 deletions
|
|
@ -14,6 +14,7 @@ class QRKeyScannerTest: XCTestCase {
|
|||
private let header = "-----BEGIN PGP PUBLIC KEY BLOCK-----"
|
||||
private let body = "key body"
|
||||
private let footer = "-----END PGP PUBLIC KEY BLOCK-----"
|
||||
private let footerWithNewline = "-----END PGP PUBLIC KEY BLOCK-----\n"
|
||||
private let privateHeader = "-----BEGIN PGP PRIVATE KEY BLOCK-----"
|
||||
|
||||
private var scanner = QRKeyScanner(keyType: .pgpPublic)
|
||||
|
|
@ -55,4 +56,10 @@ class QRKeyScannerTest: XCTestCase {
|
|||
XCTAssertEqual(scanner.add(segment: "BLOCK-----"), .completed)
|
||||
XCTAssertEqual(scanner.scannedKey, header + footer)
|
||||
}
|
||||
|
||||
func testFooterWithNewlien() {
|
||||
XCTAssertEqual(scanner.add(segment: header), .scanned(1))
|
||||
XCTAssertEqual(scanner.add(segment: footerWithNewline), .completed)
|
||||
XCTAssertEqual(scanner.scannedKey, header + footerWithNewline)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue