1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 18:27:35 +00:00

TestSuite: Hijack the ASSERT macros during unit tests.

Instead of aborting the program when we hit an assertion, just print a
message and keep going.

This allows us to write tests that provoke assertions on purpose.
This commit is contained in:
Andreas Kling 2019-08-02 09:23:03 +02:00
parent 31793b8f3a
commit 6560116b67
7 changed files with 22 additions and 2 deletions

View file

@ -1,10 +1,21 @@
#pragma once
#define AK_TEST_SUITE
#include <stdio.h>
#define ASSERT(x) \
if (!(x)) { \
fprintf(stderr, "\033[33;1mASSERT\033[0m: " #x "\n"); \
}
#define ASSERT_NOT_REACHED() fprintf(stderr, "\033[31;1mASSERT_NOT_REACHED\033[0m\n");
#define RELEASE_ASSERT ASSERT
#include "AKString.h"
#include "Function.h"
#include "NonnullRefPtrVector.h"
#include <chrono>
#include <stdio.h>
namespace AK {