From 3555341ab42b82f32cc9d7d9c8cc2fbf5c29aae1 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 4 May 2014 18:23:06 -0700 Subject: [PATCH] Fix test. --- test/gtest-extra-test.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/gtest-extra-test.cc b/test/gtest-extra-test.cc index 7cfafbd5..0a6e7df7 100644 --- a/test/gtest-extra-test.cc +++ b/test/gtest-extra-test.cc @@ -573,12 +573,17 @@ TEST(OutputRedirectTest, ErrorInDtor) { OutputRedirect *redir = new OutputRedirect(f.get()); // Put a character in a file buffer. EXPECT_EQ('x', fputc('x', f.get())); +#ifndef _WIN32 // The close function must be called inside EXPECT_STDERR, otherwise // the system may recycle closed file descriptor when redirecting the // output in EXPECT_STDERR and the second close will break output // redirection. EXPECT_STDERR(close(write_fd); delete redir, FormatSystemErrorMessage(EBADF, "cannot flush stream")); +#else + close(write_fd); + EXPECT_DEATH(delete redir, ""); +#endif write_dup.dup2(write_fd); // "undo" close or dtor of BufferedFile will fail }