Skip to content

Commit

Permalink
Merge pull request #71 from JaviSoto/master
Browse files Browse the repository at this point in the history
Fixed typo (recieved instead of received)
  • Loading branch information
Anviking committed Jan 22, 2016
2 parents 8e3fea1 + 84a9d08 commit 459c505
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Sources/Castable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public protocol Castable: Decodable {}
extension Castable {
public static func decode(j: AnyObject) throws -> Self {
guard let result = j as? Self else {
throw TypeMismatchError(expectedType: self, recievedType: j.dynamicType, object: j)
throw TypeMismatchError(expectedType: self, receivedType: j.dynamicType, object: j)
}
return result
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Decodable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public protocol Decodable {
extension NSDictionary {
public static func decode(j: AnyObject) throws -> NSDictionary {
guard let result = j as? NSDictionary else {
throw TypeMismatchError(expectedType: self, recievedType: j.dynamicType, object: j)
throw TypeMismatchError(expectedType: self, receivedType: j.dynamicType, object: j)
}
return result
}
Expand All @@ -24,7 +24,7 @@ extension NSDictionary {
extension NSArray {
public static func decode(j: AnyObject) throws -> NSArray {
guard let result = j as? NSArray else {
throw TypeMismatchError(expectedType: self, recievedType: j.dynamicType, object: j)
throw TypeMismatchError(expectedType: self, receivedType: j.dynamicType, object: j)
}
return result
}
Expand Down
8 changes: 4 additions & 4 deletions Sources/DecodingError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,22 @@ extension DecodingError {

public struct TypeMismatchError: DecodingError {

public init(expectedType: Any.Type, recievedType: Any.Type, object: AnyObject) {
public init(expectedType: Any.Type, receivedType: Any.Type, object: AnyObject) {
self.expectedType = expectedType
self.recievedType = recievedType
self.receivedType = receivedType
self.object = object
self.path = []
}

public let expectedType: Any.Type
public let recievedType: Any.Type
public let receivedType: Any.Type

public var path: [String]
public let object: AnyObject
public var rootObject: AnyObject?

public var debugDescription: String {
return "TypeMismatchError expected: \(expectedType) but \(object) is of type \(recievedType) in \(formattedPath)" }
return "TypeMismatchError expected: \(expectedType) but \(object) is of type \(receivedType) in \(formattedPath)" }
}

public struct MissingKeyError: DecodingError {
Expand Down
2 changes: 1 addition & 1 deletion Sources/NSValueCastable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extension NSValueCastable {
private typealias PointerOfSelf = UnsafeMutablePointer<Self> // Why do we have to do this?
public static func decode(j: AnyObject) throws -> Self {
guard let value = j as? NSValue else {
throw TypeMismatchError(expectedType: NSValue.self, recievedType: j.dynamicType, object: j)
throw TypeMismatchError(expectedType: NSValue.self, receivedType: j.dynamicType, object: j)
}

let pointer = PointerOfSelf.alloc(1)
Expand Down
6 changes: 3 additions & 3 deletions Tests/DecodableOperatorsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class DecodableOperatorsTests: XCTestCase {
print(a)
XCTFail()
} catch let error as TypeMismatchError {
XCTAssertEqual(String(error.recievedType), "__NSCFNumber")
XCTAssertEqual(String(error.receivedType), "__NSCFNumber")
} catch let error {
XCTFail("should not throw \(error)")
}
Expand Down Expand Up @@ -167,7 +167,7 @@ class DecodableOperatorsTests: XCTestCase {
} catch let error as TypeMismatchError where error.expectedType == NSDictionary.self {
// then
XCTAssertTrue(true)
XCTAssertEqual(String(error.recievedType), "__NSCFString")
XCTAssertEqual(String(error.receivedType), "__NSCFString")
XCTAssertEqual(error.formattedPath, "")
XCTAssertEqual(error.object as? NSString, noDictionary)
} catch let error {
Expand Down Expand Up @@ -204,7 +204,7 @@ class DecodableOperatorsTests: XCTestCase {
} catch let error as TypeMismatchError where error.expectedType == NSDictionary.self {
// then
XCTAssertTrue(true)
XCTAssertEqual(String(error.recievedType), "__NSCFString")
XCTAssertEqual(String(error.receivedType), "__NSCFString")
XCTAssertEqual(error.formattedPath, "")
XCTAssertEqual(error.object as? NSString, noDictionary)
} catch let error {
Expand Down
4 changes: 2 additions & 2 deletions Tests/ErrorPathTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class ErrorPathTests: XCTestCase {
do {
try dict => "object" => "repo" => "owner" => "login" as String
} catch let error as TypeMismatchError {
XCTAssertEqual(String(error.recievedType), "__NSCFNumber")
XCTAssertEqual(String(error.receivedType), "__NSCFNumber")
XCTAssertEqual(error.formattedPath, "object.repo.owner.login")
XCTAssertEqual(error.object as? Int, 0)
} catch let error {
Expand All @@ -86,7 +86,7 @@ class ErrorPathTests: XCTestCase {
try Tree.decode(dict)
XCTFail()
} catch let error as TypeMismatchError {
XCTAssertEqual(String(error.recievedType), "__NSCFNumber")
XCTAssertEqual(String(error.receivedType), "__NSCFNumber")
XCTAssertEqual(error.formattedPath, "apples.color.name")
} catch let error {
XCTFail("should not throw this exception: \(error)")
Expand Down

0 comments on commit 459c505

Please sign in to comment.