Skip to content

Instantly share code, notes, and snippets.

@scotteg
Created December 25, 2014 16:22
Show Gist options
  • Save scotteg/12322fbb8c00a55656da to your computer and use it in GitHub Desktop.
Save scotteg/12322fbb8c00a55656da to your computer and use it in GitHub Desktop.
How to use XCTest in Swift with an optional
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")
}
}
@almassapargali
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment