Created
September 25, 2015 11:56
-
-
Save fwielstra/dd02aaac645ac7445653 to your computer and use it in GitHub Desktop.
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
import ObjectMapper | |
struct Test: Mappable { | |
let name: String | |
init?(_ map: Map) { | |
name = map["name"].valueOrFail() | |
if !map.isValid { | |
return nil | |
} | |
} | |
func mapping(map: Map) { | |
} | |
} |
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
import XCTest | |
import ObjectMapper | |
class TestTest: XCTestCase { | |
func testParseJson() { | |
// works | |
let validJsonString = "{ \"name\": \"test\" }" | |
Mapper<Test>().map(validJsonString) | |
// EXEC_BAD_ACCESS | |
let invalidJsonString = "{ \"NOT name\": \"test\" }" | |
Mapper<Test>().map(invalidJsonString) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment