Преглед изворни кода

LibTest: Add FAIL() macro allow tests to force failure with message.

Brian Gianforcaro пре 4 година
родитељ
комит
a9df58d7b2
1 измењених фајлова са 6 додато и 0 уклоњено
  1. 6 0
      Userland/Libraries/LibTest/Macros.h

+ 6 - 0
Userland/Libraries/LibTest/Macros.h

@@ -85,3 +85,9 @@ void current_test_case_did_fail();
             ::Test::current_test_case_did_fail();                                                               \
         }                                                                                                       \
     } while (false)
+
+#define FAIL(message)                                                                  \
+    do {                                                                               \
+        ::AK::warnln("\033[31;1mFAIL\033[0m: {}:{}: {}", __FILE__, __LINE__, message); \
+        ::Test::current_test_case_did_fail();                                          \
+    } while (false)