Separate parser and helpers from Password class for better testability

This commit is contained in:
Danny Moesch 2018-11-11 18:09:52 +01:00 committed by Bob Sun
parent 2abbceb2e9
commit 7c12263458
17 changed files with 913 additions and 537 deletions

View file

@ -0,0 +1,35 @@
//
// StringExtensionTest.swift
// passKitTests
//
// Created by Danny Moesch on 30.09.18.
// Copyright © 2018 Bob Sun. All rights reserved.
//
import XCTest
@testable import passKit
class StringExtensionTest: XCTestCase {
func testStringByAddingPercentEncodingForRFC3986() {
[
("!#$&'()*+,/:;=?@[]^", "%21%23%24%26%27%28%29%2A%2B%2C/%3A%3B%3D?%40%5B%5D%5E"),
("-._~/?", "-._~/?"),
("A*b!c", "A%2Ab%21c"),
].forEach { unencoded, encoded in
XCTAssertEqual(unencoded.stringByAddingPercentEncodingForRFC3986(), encoded)
}
}
func testConcatenateAsLines() {
[
("a" | "b", "a\nb"),
("" | "b", "\nb"),
("a" | "", "a"),
("" | "", ""),
].forEach { concatenated, result in
XCTAssertEqual(concatenated, result)
}
}
}