Change testing extensions into a framework

This commit is contained in:
Milen Dzhumerov 2019-07-27 12:44:42 +01:00
parent 77bf89d9c6
commit cc3a8c895a
2 changed files with 5 additions and 6 deletions

View File

@ -31,9 +31,8 @@ let package = Package(
"HeaderMapCore",
]
),
.testTarget(
name: "HeaderMapTesting",
path: "Sources/HeaderMapTesting"
.target(
name: "HeaderMapTesting"
),
.testTarget(
name: "HeaderMapCoreTests",

View File

@ -27,8 +27,8 @@ public enum OptionalError: Error {
case unwrappedNil
}
extension Optional {
public func unwrap(file: StaticString = #file, line: UInt = #line) throws -> Wrapped {
public extension Optional {
func unwrap(file: StaticString = #file, line: UInt = #line) throws -> Wrapped {
guard let unwrapped = self else {
XCTFail("Unwrapped nil: \(file):\(line)")
throw OptionalError.unwrappedNil
@ -39,7 +39,7 @@ extension Optional {
}
public extension XCTestCase {
public func loadFile(named name: String, extension ext: String? = nil) throws -> Data? {
func loadFile(named name: String, extension ext: String? = nil) throws -> Data? {
let url = Bundle(for: type(of: self)).url(forResource: name, withExtension: ext)
return try url.map { try Data(contentsOf: $0) }
}