Skip to content

Instantly share code, notes, and snippets.

@fwielstra fwielstra/Test.swift
Created Sep 25, 2015

Embed
What would you like to do?
import ObjectMapper
struct Test: Mappable {
let name: String
init?(_ map: Map) {
name = map["name"].valueOrFail()
if !map.isValid {
return nil
}
}
func mapping(map: Map) {
}
}
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
You can’t perform that action at this time.