Don't use deprecated API.

This commit is contained in:
Victor Zverovich 2014-06-28 20:03:46 -07:00
parent c649007ed8
commit 856e129cc6

View File

@ -305,12 +305,12 @@ TEST(ExpectTest, EXPECT_SYSTEM_ERROR) {
" Actual: it throws nothing."); " Actual: it throws nothing.");
EXPECT_NONFATAL_FAILURE( EXPECT_NONFATAL_FAILURE(
EXPECT_SYSTEM_ERROR(ThrowSystemError(), EDOM, "other"), EXPECT_SYSTEM_ERROR(ThrowSystemError(), EDOM, "other"),
str(fmt::Format( str(fmt::format(
"ThrowSystemError() throws an exception with a different message.\n" "ThrowSystemError() throws an exception with a different message.\n"
"Expected: {}\n" "Expected: {}\n"
" Actual: {}") " Actual: {}",
<< FormatSystemErrorMessage(EDOM, "other") FormatSystemErrorMessage(EDOM, "other"),
<< FormatSystemErrorMessage(EDOM, "test"))); FormatSystemErrorMessage(EDOM, "test"))));
} }
// Tests EXPECT_WRITE. // Tests EXPECT_WRITE.
@ -687,7 +687,7 @@ TEST(FileTest, Dup2) {
TEST(FileTest, Dup2Error) { TEST(FileTest, Dup2Error) {
File f = OpenFile(); File f = OpenFile();
EXPECT_SYSTEM_ERROR_NOASSERT(f.dup2(-1), EBADF, EXPECT_SYSTEM_ERROR_NOASSERT(f.dup2(-1), EBADF,
fmt::Format("cannot duplicate file descriptor {} to -1") << f.descriptor()); str(fmt::format("cannot duplicate file descriptor {} to -1", f.descriptor())));
} }
TEST(FileTest, Dup2NoExcept) { TEST(FileTest, Dup2NoExcept) {
@ -756,7 +756,7 @@ TEST(OutputRedirectTest, FlushErrorInCtor) {
FMT_POSIX(close(write_fd)); FMT_POSIX(close(write_fd));
OutputRedirect *redir = 0; OutputRedirect *redir = 0;
EXPECT_SYSTEM_ERROR_NOASSERT(redir = new OutputRedirect(f.get()), EXPECT_SYSTEM_ERROR_NOASSERT(redir = new OutputRedirect(f.get()),
EBADF, fmt::Format("cannot flush stream")); EBADF, "cannot flush stream");
delete redir; delete redir;
write_copy.dup2(write_fd); // "undo" close or dtor will fail write_copy.dup2(write_fd); // "undo" close or dtor will fail
} }
@ -768,7 +768,7 @@ TEST(OutputRedirectTest, DupErrorInCtor) {
FMT_POSIX(close(fd)); FMT_POSIX(close(fd));
OutputRedirect *redir = 0; OutputRedirect *redir = 0;
EXPECT_SYSTEM_ERROR_NOASSERT(redir = new OutputRedirect(f.get()), EXPECT_SYSTEM_ERROR_NOASSERT(redir = new OutputRedirect(f.get()),
EBADF, fmt::Format("cannot duplicate file descriptor {}") << fd); EBADF, str(fmt::format("cannot duplicate file descriptor {}", fd)));
copy.dup2(fd); // "undo" close or dtor will fail copy.dup2(fd); // "undo" close or dtor will fail
delete redir; delete redir;
} }
@ -799,7 +799,7 @@ TEST(OutputRedirectTest, FlushErrorInRestoreAndRead) {
EXPECT_EQ('x', fputc('x', f.get())); EXPECT_EQ('x', fputc('x', f.get()));
FMT_POSIX(close(write_fd)); FMT_POSIX(close(write_fd));
EXPECT_SYSTEM_ERROR_NOASSERT(redir.RestoreAndRead(), EXPECT_SYSTEM_ERROR_NOASSERT(redir.RestoreAndRead(),
EBADF, fmt::Format("cannot flush stream")); EBADF, "cannot flush stream");
write_copy.dup2(write_fd); // "undo" close or dtor will fail write_copy.dup2(write_fd); // "undo" close or dtor will fail
} }