Add ThrowCError to throw an exception on C library errors.

This commit is contained in:
Victor Zverovich
2014-04-30 10:18:11 -07:00
parent 2c6372d790
commit f79398699b
3 changed files with 55 additions and 13 deletions
+1
View File
@@ -260,6 +260,7 @@ TEST(UtilTest, StrError) {
message = StrError(-1, buffer, BUFFER_SIZE);
EXPECT_EQ(0, errno);
EXPECT_GE(BUFFER_SIZE - 1, std::strlen(message));
EXPECT_STREQ(strerror(-1), message);
message = StrError(-1, buffer, std::strlen(message));
EXPECT_EQ(ERANGE, errno);
}