Import latest bootstrap.sh
[m6w6/libmemcached] / libtest / unittest.cc
index 834614fcbc4fb3fe4fed08488afda467d887d5f8..59351762645175738a6b366c716e19bfa67c0a1e 100644 (file)
@@ -142,6 +142,25 @@ static test_return_t test_throw_skip_macro_TEST(void *)
   return TEST_FAILURE;
 }
 
+static test_return_t test_throw_skip_unless_macro_TEST(void *)
+{
+  try {
+    SKIP_UNLESS(false);
+  }
+  catch (const libtest::__skipped&)
+  {
+    return TEST_SUCCESS;
+  }
+  catch (...)
+  {
+    FAIL("SLIP_UNLESS() failed to throw libtest::_skipped");
+  }
+
+  FAIL("SLIP_UNLESS() failed to throw");
+
+  return TEST_FAILURE;
+}
+
 static test_return_t test_throw_skip_TEST(void *)
 {
   try {
@@ -181,14 +200,19 @@ static test_return_t test_throw_fail_TEST(void *)
 }
 #pragma GCC diagnostic ignored "-Wstack-protector"
 
+#ifdef __clang__
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wformat-security"
+#endif
+
 static test_return_t ASSERT_FALSE__TEST(void *)
 {
   try {
-    ASSERT_FALSE_(true, __func__);
+    ASSERT_FALSE(true);
   }
   catch (const libtest::__failure& e)
   {
-    ASSERT_STREQ(e.what(), "Assertion '!true' [ ASSERT_FALSE__TEST ]");
+    ASSERT_STREQ(e.what(), "Assertion '!true'");
     return TEST_SUCCESS;
   }
   catch (...)
@@ -199,6 +223,10 @@ static test_return_t ASSERT_FALSE__TEST(void *)
   return TEST_FAILURE;
 }
 
+#ifdef __clang__
+# pragma GCC diagnostic pop
+#endif
+
 static test_return_t ASSERT_NEQ_FAIL_TEST(void *)
 {
   try {
@@ -1034,6 +1062,7 @@ test_st tests_log[] ={
   {"SUCCESS", false, test_throw_success_TEST },
   {"libtest::__skipped", false, test_throw_skip_TEST },
   {"SKIP_IF", false, test_throw_skip_macro_TEST },
+  {"SKIP_UNLESS", false, test_throw_skip_unless_macro_TEST },
   {"FAIL", false, test_throw_fail_TEST },
   {"ASSERT_FALSE_", false, ASSERT_FALSE__TEST },
   {"ASSERT_FALSE", false, ASSERT_FALSE_TEST },