aboutsummaryrefslogtreecommitdiffhomepage
path: root/objectivec/Tests/GPBCodedInputStreamTests.m
diff options
context:
space:
mode:
authorGravatar Thomas Van Lenten <thomasvl@google.com>2016-04-05 17:04:36 -0400
committerGravatar Thomas Van Lenten <thomasvl@google.com>2016-04-05 17:16:33 -0400
commitc9167f2acdd8ab477acb620cdd0bd231c8a0f3d0 (patch)
tree2e07a34302b55980b5545c5196958bed09ba9f7c /objectivec/Tests/GPBCodedInputStreamTests.m
parentf3f5b3fb64308817c5df105321995c5b9d0c0be7 (diff)
Error during parsing for invalid UTF-8 instead of dropping dropping data.
This seems to be some code evolution side effects. Back when there was a custom string class, we couldn't really error when we finally saw the string was bad so we had to return the empty string, but now that full validation is done up front, it can error out.
Diffstat (limited to 'objectivec/Tests/GPBCodedInputStreamTests.m')
-rw-r--r--objectivec/Tests/GPBCodedInputStreamTests.m11
1 files changed, 5 insertions, 6 deletions
diff --git a/objectivec/Tests/GPBCodedInputStreamTests.m b/objectivec/Tests/GPBCodedInputStreamTests.m
index b40360eb..cc402156 100644
--- a/objectivec/Tests/GPBCodedInputStreamTests.m
+++ b/objectivec/Tests/GPBCodedInputStreamTests.m
@@ -283,16 +283,15 @@
[output writeRawData:[NSData dataWithBytes:bytes length:sizeof(bytes)]];
[output flush];
- NSData* data =
+ NSData *data =
[rawOutput propertyForKey:NSStreamDataWrittenToMemoryStreamKey];
GPBCodedInputStream* input = [GPBCodedInputStream streamWithData:data];
+ NSError *error = nil;
TestAllTypes* message = [TestAllTypes parseFromCodedInputStream:input
extensionRegistry:nil
- error:NULL];
- XCTAssertNotNil(message);
- // Make sure we can read string properties twice without crashing.
- XCTAssertEqual([message.defaultString length], (NSUInteger)0);
- XCTAssertEqualObjects(@"", message.defaultString);
+ error:&error];
+ XCTAssertNotNil(error);
+ XCTAssertNil(message);
}
- (void)testBOMWithinStrings {