-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Equatable functionality to JSONValue
- Loading branch information
Tony DiPasquale
committed
Jan 7, 2015
1 parent
f4c0628
commit e40f9ea
Showing
3 changed files
with
40 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import XCTest | ||
import Argo | ||
|
||
class EquatableSpec: XCTestCase { | ||
func testEqualJSONObjects() { | ||
let json: AnyObject? = JSONFileReader.JSON(fromFile: "types") | ||
let parsed = json >>- JSONValue.parse | ||
let anotherParsed = json >>- JSONValue.parse | ||
|
||
XCTAssertEqual(parsed!, anotherParsed!) | ||
} | ||
|
||
func testNotEqualJSONObjects() { | ||
let json: AnyObject? = JSONFileReader.JSON(fromFile: "types") | ||
let anotherJSON: AnyObject? = JSONFileReader.JSON(fromFile: "types_fail_embedded") | ||
let parsed = json >>- JSONValue.parse | ||
let anotherParsed = anotherJSON >>- JSONValue.parse | ||
|
||
XCTAssertNotEqual(parsed!, anotherParsed!) | ||
} | ||
} |