Commit 492fad43 authored by Jim Meyering's avatar Jim Meyering Committed by Facebook Github Bot

define SKIP_IF

Summary:
Finding ourselves writing too many identical "if (expr) SKIP << ..." statements,
this change factors out/encapsulates the functionality.

Reviewed By: yfeldblum

Differential Revision: D6727531

fbshipit-source-id: 703abcd5d8c30a6ebab94327a12da4f2d1f7ff74
parent 67462593
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
/* /*
* This file contains additional gtest-style check macros to use in unit tests. * This file contains additional gtest-style check macros to use in unit tests.
* *
* - SKIP() * - SKIP(), SKIP_IF(EXPR)
* - EXPECT_THROW_RE(), ASSERT_THROW_RE() * - EXPECT_THROW_RE(), ASSERT_THROW_RE()
* - EXPECT_THROW_ERRNO(), ASSERT_THROW_ERRNO() * - EXPECT_THROW_ERRNO(), ASSERT_THROW_ERRNO()
* - AreWithinSecs() * - AreWithinSecs()
...@@ -46,6 +46,13 @@ ...@@ -46,6 +46,13 @@
// interprets the message. // interprets the message.
#define SKIP() GTEST_FATAL_FAILURE_("Test skipped by client") #define SKIP() GTEST_FATAL_FAILURE_("Test skipped by client")
// Encapsulate conditional-skip, since it's nontrivial to get right.
#define SKIP_IF(expr) \
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
if (!(expr)) { \
} else \
SKIP()
#define TEST_THROW_ERRNO_(statement, errnoValue, fail) \ #define TEST_THROW_ERRNO_(statement, errnoValue, fail) \
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
if (::folly::test::detail::CheckResult gtest_result = \ if (::folly::test::detail::CheckResult gtest_result = \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment