mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 08:08:43 +00:00
AK: TestSuite: Terminate when ASSERT_NOT_REACHED is called.
Previously, it would just print something with 'FAIL' to stderr which would be picked up by CTest. However, some code assumes that ASSERT_NOT_REACHED() doesn't return, for example: bool foo(int value) { switch(value) { case 0: return true; case 1: return false; default: ASSERT_NOT_REACHED(); } // warning: control reaches end of non-void function }
This commit is contained in:
parent
103f659ef6
commit
c2be38e50f
Notes:
sideshowbarker
2024-07-19 03:17:34 +09:00
Author: https://github.com/asynts
Commit: c2be38e50f
Pull-request: https://github.com/SerenityOS/serenity/pull/3261
1 changed files with 10 additions and 4 deletions
|
@ -40,11 +40,17 @@
|
|||
fprintf(stderr, "\033[31;1mFAIL\033[0m: %s:%d: RELEASE_ASSERT(%s) failed\n", __FILE__, __LINE__, #x); \
|
||||
}
|
||||
|
||||
#define ASSERT_NOT_REACHED() \
|
||||
fprintf(stderr, "\033[31;1mFAIL\033[0m: %s:%d: ASSERT_NOT_REACHED() called\n", __FILE__, __LINE__);
|
||||
#define ASSERT_NOT_REACHED() \
|
||||
{ \
|
||||
fprintf(stderr, "\033[31;1mFAIL\033[0m: %s:%d: ASSERT_NOT_REACHED() called\n", __FILE__, __LINE__); \
|
||||
abort(); \
|
||||
}
|
||||
|
||||
#define TODO \
|
||||
fprintf(stderr, "\033[31;1mFAIL\033[0m: %s:%d: TODO() called\n", __FILE__, __LINE__);
|
||||
#define TODO() \
|
||||
{ \
|
||||
fprintf(stderr, "\033[31;1mFAIL\033[0m: %s:%d: TODO() called\n", __FILE__, __LINE__); \
|
||||
abort(); \
|
||||
}
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue