Commit 22c662c8 authored by gejun's avatar gejun

fix UT of base/errno.cpp

parent 9a826ef9
...@@ -53,7 +53,7 @@ int DescribeCustomizedErrno( ...@@ -53,7 +53,7 @@ int DescribeCustomizedErrno(
const char* berror(int error_code) { const char* berror(int error_code) {
if (error_code == -1) { if (error_code == -1) {
return "General Error -1"; return "General error -1";
} }
if (error_code >= base::ERRNO_BEGIN && error_code < base::ERRNO_END) { if (error_code >= base::ERRNO_BEGIN && error_code < base::ERRNO_END) {
const char* s = base::errno_desc[error_code - base::ERRNO_BEGIN]; const char* s = base::errno_desc[error_code - base::ERRNO_BEGIN];
...@@ -66,7 +66,7 @@ const char* berror(int error_code) { ...@@ -66,7 +66,7 @@ const char* berror(int error_code) {
} }
} }
snprintf(base::tls_error_buf, base::ERROR_BUFSIZE, snprintf(base::tls_error_buf, base::ERROR_BUFSIZE,
"Unknown Error %d", error_code); "Unknown error %d", error_code);
return base::tls_error_buf; return base::tls_error_buf;
} }
......
...@@ -39,7 +39,7 @@ TEST_F(ErrnoTest, customized_errno) { ...@@ -39,7 +39,7 @@ TEST_F(ErrnoTest, customized_errno) {
ASSERT_STREQ("the thread is interrupted", berror(EBREAK)); ASSERT_STREQ("the thread is interrupted", berror(EBREAK));
ASSERT_STREQ("something happened", berror(ESTH)); ASSERT_STREQ("something happened", berror(ESTH));
ASSERT_STREQ("OK!", berror(EOK)); ASSERT_STREQ("OK!", berror(EOK));
ASSERT_STREQ("Unknown Error(1000)", berror(1000)); ASSERT_STREQ("Unknown error 1000", berror(1000));
errno = ESTOP; errno = ESTOP;
printf("Something got wrong, %m\n"); printf("Something got wrong, %m\n");
......
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