-
-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A missing key in an embedded type should be a failure.
- Loading branch information
Tony DiPasquale
committed
Oct 12, 2016
1 parent
058d428
commit 5fdd798
Showing
8 changed files
with
118 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"id": 3, | ||
"text": "A Cool story.", | ||
"author": { | ||
"id": 1, | ||
"name": "Cool User" | ||
}, | ||
"comments": [], | ||
"location": { | ||
"lat": -41.24673, | ||
"lng": 72.89244 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"id": 3, | ||
"text": "A Cool story.", | ||
"author": { | ||
"id": 1, | ||
"name": "Cool User" | ||
}, | ||
"comments": [], | ||
"location": { | ||
"lat": -41.24673, | ||
"lng": 72.89244, | ||
"title": "Cool Location" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import XCTest | ||
import Argo | ||
|
||
final class EmbeddedDecodingTests: XCTestCase { | ||
func testDecodeEmbeddedObject() { | ||
let post: Decoded<LocationPost> = decode(json(fromFile: "location_post")!) | ||
|
||
switch post.value { | ||
case .some: XCTAssert(true) | ||
case .none: XCTFail("Unexpected Failure") | ||
} | ||
} | ||
|
||
func testFailOnEmbeddedObject() { | ||
let post: Decoded<LocationPost> = decode(json(fromFile: "bad_location_post")!) | ||
|
||
switch post.error { | ||
case .some: XCTAssert(true) | ||
case .none: XCTFail("Unexpected Success") | ||
} | ||
} | ||
} |