X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libtest%2Funittest.cc;h=59351762645175738a6b366c716e19bfa67c0a1e;hb=b30da3e793829246675966830c668c3f60496e07;hp=c7be63fa49c90a693e7110e8911b3788fea2cfac;hpb=a6125e493c92ad44941345da1e123fa6e9b8d272;p=m6w6%2Flibmemcached diff --git a/libtest/unittest.cc b/libtest/unittest.cc index c7be63fa..59351762 100644 --- a/libtest/unittest.cc +++ b/libtest/unittest.cc @@ -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,6 +200,11 @@ 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 { @@ -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 },