mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
AK: Untangle TestSuite assertions a bit
This commit is contained in:
parent
531d72fdfd
commit
644d981b2b
Notes:
sideshowbarker
2024-07-18 22:00:02 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/644d981b2b8 Pull-request: https://github.com/SerenityOS/serenity/pull/5468
3 changed files with 17 additions and 19 deletions
|
@ -26,18 +26,14 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#ifndef AK_TEST_SUITE
|
||||
|
||||
# if defined(KERNEL)
|
||||
# include <Kernel/Assertions.h>
|
||||
# else
|
||||
# include <assert.h>
|
||||
# ifndef __serenity__
|
||||
# define ASSERT assert
|
||||
# define ASSERT_NOT_REACHED() assert(false)
|
||||
# define RELEASE_ASSERT assert
|
||||
# define TODO ASSERT_NOT_REACHED
|
||||
# endif
|
||||
#if defined(KERNEL)
|
||||
# include <Kernel/Assertions.h>
|
||||
#else
|
||||
# include <assert.h>
|
||||
# ifndef __serenity__
|
||||
# define ASSERT assert
|
||||
# define ASSERT_NOT_REACHED() assert(false)
|
||||
# define RELEASE_ASSERT assert
|
||||
# define TODO ASSERT_NOT_REACHED
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#define AK_TEST_SUITE
|
||||
#include <AK/Assertions.h>
|
||||
|
||||
namespace AK {
|
||||
|
||||
|
@ -37,39 +37,40 @@ void warnln(const char* fmtstr, const Parameters&...);
|
|||
|
||||
using AK::warnln;
|
||||
|
||||
#undef ASSERT
|
||||
#define ASSERT(x) \
|
||||
do { \
|
||||
if (!(x)) \
|
||||
::AK::warnln("\033[31;1mFAIL\033[0m: {}:{}: ASSERT({}) failed", __FILE__, __LINE__, #x); \
|
||||
} while (false)
|
||||
|
||||
#undef RELEASE_ASSERT
|
||||
#define RELEASE_ASSERT(x) \
|
||||
do { \
|
||||
if (!(x)) \
|
||||
::AK::warnln("\033[31;1mFAIL\033[0m: {}:{}: RELEASE_ASSERT({}) failed", __FILE__, __LINE__, #x); \
|
||||
} while (false)
|
||||
|
||||
#undef ASSERT_NOT_REACHED
|
||||
#define ASSERT_NOT_REACHED() \
|
||||
do { \
|
||||
::AK::warnln("\033[31;1mFAIL\033[0m: {}:{}: ASSERT_NOT_REACHED() called", __FILE__, __LINE__); \
|
||||
::abort(); \
|
||||
} while (false)
|
||||
|
||||
#undef TODO
|
||||
#define TODO() \
|
||||
do { \
|
||||
::AK::warnln(stderr, "\033[31;1mFAIL\033[0m: {}:{}: TODO() called", __FILE__, __LINE__); \
|
||||
::abort(); \
|
||||
} while (false)
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <AK/Format.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/NonnullRefPtrVector.h>
|
||||
#include <AK/String.h>
|
||||
|
||||
#include <LibCore/ArgsParser.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
namespace AK {
|
||||
|
|
|
@ -24,9 +24,10 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/StringUtils.h>
|
||||
#include <AK/TestSuite.h>
|
||||
|
||||
#include <AK/StringUtils.h>
|
||||
|
||||
TEST_CASE(matches_null)
|
||||
{
|
||||
EXPECT(AK::StringUtils::matches(StringView(), StringView()));
|
||||
|
|
Loading…
Reference in a new issue