Created
December 25, 2014 16:22
-
-
Save scotteg/12322fbb8c00a55656da to your computer and use it in GitHub Desktop.
How to use XCTest in Swift with an optional
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
func testCopyingLists() { | |
if let listCopy = list.copy() as? List { | |
XCTAssertEqual(list, listCopy, "listCopy should be equal to list") | |
} else { | |
XCTFail("listCopy should not be nil") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Don't know even, I think it depends on context and personal tastes. For example, I have a tests which tests JSON values and if it has value then tests it's type.