From 0bece9425749902680abc323e9a539d0b6d6d8b4 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Wed, 30 Apr 2014 12:39:31 -0700 Subject: [PATCH] Fix test. --- format-test.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/format-test.cc b/format-test.cc index a1f55496..8eca202a 100644 --- a/format-test.cc +++ b/format-test.cc @@ -1556,10 +1556,12 @@ TEST(FormatterTest, FormatExamples) { EXPECT_EQ("0123456789", s); } - const char *filename = "nonexistent"; - FILE *f = fopen(filename, "r"); - if (!f) - fmt::ThrowSystemError(errno, "Cannot open file '{}'") << filename; + EXPECT_THROW({ + const char *filename = "nonexistent"; + FILE *f = fopen(filename, "r"); + if (!f) + fmt::ThrowSystemError(errno, "Cannot open file '{}'") << filename; + }, fmt::SystemError); } TEST(FormatterTest, StrNamespace) {