From 7da4ef82aee382777bb50aadd4af14a482739d10 Mon Sep 17 00:00:00 2001 From: Adam Simpkins Date: Wed, 17 Jan 2018 10:05:21 -0800 Subject: [PATCH 1/1] suppress warnings in tests for deprecated functions Summary: Update ShellTest and PromiseTest to suppress warnings about using deprecated functions in the tests for those functions. Reviewed By: yfeldblum Differential Revision: D6735670 fbshipit-source-id: 89edcb49d1eff3132398aaef88f5a5cae82e3557 --- folly/futures/test/PromiseTest.cpp | 5 +++++ folly/system/test/ShellTest.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/folly/futures/test/PromiseTest.cpp b/folly/futures/test/PromiseTest.cpp index a48e8a00..858f9533 100644 --- a/folly/futures/test/PromiseTest.cpp +++ b/folly/futures/test/PromiseTest.cpp @@ -141,7 +141,12 @@ TEST(Promise, setException) { { Promise p; auto f = p.getFuture(); + // Calling setException() with an exception_ptr is deprecated, + // but don't complain about this in the test for this function. + FOLLY_PUSH_WARNING + FOLLY_GCC_DISABLE_WARNING("-Wdeprecated-declarations") p.setException(std::make_exception_ptr(eggs)); + FOLLY_POP_WARNING EXPECT_THROW(f.value(), eggs_t); } { diff --git a/folly/system/test/ShellTest.cpp b/folly/system/test/ShellTest.cpp index f43b7fc4..69212c77 100644 --- a/folly/system/test/ShellTest.cpp +++ b/folly/system/test/ShellTest.cpp @@ -43,6 +43,10 @@ TEST(Shell, Shellify) { EXPECT_EQ(command[2], "ls 'blah'\\''; rm -rf /'"); } +// Tests for the deprecated shellify() function. +// Don't warn about using this deprecated function in the test for it. +FOLLY_PUSH_WARNING +FOLLY_GCC_DISABLE_WARNING("-Wdeprecated-declarations") TEST(Shell, Shellify_deprecated) { auto command = shellify("rm -rf /"); EXPECT_EQ(command[0], "/bin/sh"); @@ -58,3 +62,4 @@ TEST(Shell, Shellify_deprecated) { command = shellify("ls {}", "blah'; rm -rf /"); EXPECT_EQ(command[2], "ls 'blah'\\''; rm -rf /'"); } +FOLLY_POP_WARNING -- 2.34.1