From e4f8b069b538d6c1ff616e79622785fde5c2cd87 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sat, 3 May 2014 20:49:42 -0700 Subject: [PATCH] Too young to die. --- test/gtest-extra-test.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/gtest-extra-test.cc b/test/gtest-extra-test.cc index 6da09a72..35eef201 100644 --- a/test/gtest-extra-test.cc +++ b/test/gtest-extra-test.cc @@ -336,6 +336,7 @@ TEST(FileTest, ReadError) { File read_end, write_end; File::pipe(read_end, write_end); char buf; + // We intentionally read from write_end to cause error. EXPECT_SYSTEM_ERROR(write_end.read(&buf, 1), EBADF, "cannot read from file"); } @@ -348,8 +349,10 @@ TEST(FileTest, Write) { } TEST(FileTest, WriteError) { - File f; - EXPECT_SYSTEM_ERROR_OR_DEATH(f.write(" ", 1), EBADF, "cannot write to file"); + File read_end, write_end; + File::pipe(read_end, write_end); + // We intentionally write to read_end to cause error. + EXPECT_SYSTEM_ERROR(read_end.write(" ", 1), EBADF, "cannot write to file"); } TEST(FileTest, Dup) {