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 a48e8a00b72d1807a3690a0e334df9a19792ad19..858f9533bf63cf5058279051d7575ba0953c08fd 100644 (file)
@@ -141,7 +141,12 @@ TEST(Promise, setException) {
   {
     Promise<Unit> p;
     auto f = p.getFuture();
   {
     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));
     p.setException(std::make_exception_ptr(eggs));
+    FOLLY_POP_WARNING
     EXPECT_THROW(f.value(), eggs_t);
   }
   {
     EXPECT_THROW(f.value(), eggs_t);
   }
   {
index f43b7fc4aadab1afb4c73ca734f366987a74f2e8..69212c775d3ccfd3e9fc603db04b179b45271a9b 100644 (file)
@@ -43,6 +43,10 @@ TEST(Shell, Shellify) {
   EXPECT_EQ(command[2], "ls 'blah'\\''; rm -rf /'");
 }
 
   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");
 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 /'");
 }
   command = shellify("ls {}", "blah'; rm -rf /");
   EXPECT_EQ(command[2], "ls 'blah'\\''; rm -rf /'");
 }
+FOLLY_POP_WARNING