suppress warnings in tests for deprecated functions
authorAdam Simpkins <simpkins@fb.com>
Wed, 17 Jan 2018 18:05:21 +0000 (10:05 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 17 Jan 2018 18:20:41 +0000 (10:20 -0800)
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
folly/system/test/ShellTest.cpp

index a48e8a0..858f953 100644 (file)
@@ -141,7 +141,12 @@ TEST(Promise, setException) {
   {
     Promise<Unit> 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);
   }
   {
index f43b7fc..69212c7 100644 (file)
@@ -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