Skip to content

Commit

Permalink
[R] Always use default value for dataUsingEncoding
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominic Frei committed Feb 1, 2016
1 parent 89c82ba commit 9647b38
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion JsonPatchSwift/JPSJsonPatch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ extension JPSJsonPatch {
static func applyPatch(jsonPatch: JPSJsonPatch, toJson json: JSON) -> JSON {
// let pointer = jsonPatch.operations[0].pointer
// json[pointer.pointerValue]// = jsonPatch.operation[0].value
return JSON(data: "{ \"bar\" : \"foo\" }".dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)!)
return JSON(data: "{ \"bar\" : \"foo\" }".dataUsingEncoding(NSUTF8StringEncoding)!)
}

}
Expand Down
6 changes: 3 additions & 3 deletions JsonPatchSwiftTests/JPSAddOperationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class JPSAddOperationTests: XCTestCase {

func testIfPathToNonExistingMemberCreatesNewMember() {
let patch = try! JPSJsonPatch("{ \"op\" : \"add\", \"path\" : \"/a\", \"value\" : \"foo\" }")
let json = JSON(data: "{\"b\" : \"bar\"}".dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)!)
let json = JSON(data: "{\"b\" : \"bar\"}".dataUsingEncoding(NSUTF8StringEncoding)!)
let resultingJson = JPSJsonPatch.applyPatch(patch, toJson: json)
let expectedJson = JSON(data: "{ \"a\" : \"foo\", \"b\" : \"bar\" }".dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)!)
let expectedJson = JSON(data: "{ \"a\" : \"foo\", \"b\" : \"bar\" }".dataUsingEncoding(NSUTF8StringEncoding)!)
XCTAssertEqual(resultingJson, expectedJson)
}

Expand All @@ -40,7 +40,7 @@ class JPSAddOperationTests: XCTestCase {
let json = JSON(data: " { \"foo\" : \"bar\" } ".dataUsingEncoding(NSUTF8StringEncoding)!)
let jsonPatch = try! JPSJsonPatch("{ \"op\": \"add\", \"path\": \"\", \"value\": { \"bar\" : \"foo\" } }")
let resultingJson = JPSJsonPatch.applyPatch(jsonPatch, toJson: json)
let expectedJson = JSON(data: "{ \"bar\" : \"foo\" }".dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)!)
let expectedJson = JSON(data: "{ \"bar\" : \"foo\" }".dataUsingEncoding(NSUTF8StringEncoding)!)
XCTAssertEqual(resultingJson, expectedJson)
}

Expand Down

0 comments on commit 9647b38

Please sign in to comment.