Commit 38508e9b authored by Felix Jendrusch's avatar Felix Jendrusch

Add test for failing write of raw pointer to output stream

parent a48d58df
......@@ -423,4 +423,14 @@
}
}
- (void)testThatItThrowsWhenWriteRawPtrFails {
NSOutputStream *output = [NSOutputStream outputStreamToMemory];
GPBCodedOutputStream *codedOutput =
[GPBCodedOutputStream streamWithOutputStream:output bufferSize:0]; // Skip buffering.
[output close]; // Close the output stream to force failure on write.
const char *cString = "raw";
XCTAssertThrowsSpecificNamed([codedOutput writeRawPtr:cString offset:0 length:strlen(cString)],
NSException, GPBCodedOutputStreamException_WriteFailed);
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment