From 897397760c93feeb89e17202538b6d9df5ae2da7 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Wed, 9 Jul 2014 09:55:13 -0700 Subject: [PATCH] Fix a test. --- test/gtest-extra-test.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/gtest-extra-test.cc b/test/gtest-extra-test.cc index 5b191c5f..fe98d514 100644 --- a/test/gtest-extra-test.cc +++ b/test/gtest-extra-test.cc @@ -520,7 +520,14 @@ TEST(BufferedFileTest, CloseError) { TEST(BufferedFileTest, Fileno) { BufferedFile f; - EXPECT_DEATH(f.fileno(), ""); + // fileno on a null FILE pointer either crashes or returns an error. + EXPECT_DEATH({ + try { + f.fileno(); + } catch (fmt::SystemError) { + std::exit(0); + } + }, ""); f = OpenBufferedFile(); EXPECT_TRUE(f.fileno() != -1); File copy = File::dup(f.fileno());