1
0
mirror of https://github.com/ThrowTheSwitch/Unity.git synced 2026-01-25 09:21:36 +01:00

Add TEST_MESSAGE for outputting messages without aborting a test and _MESSAGE variant to TEST_PASS collection.

This commit is contained in:
Mark VanderVoord
2019-07-06 11:02:32 -04:00
parent a54d58a8fd
commit 0000f1e6d2
5 changed files with 59 additions and 2 deletions

View File

@@ -1715,6 +1715,20 @@ void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line)
UNITY_IGNORE_AND_BAIL;
}
//-----------------------------------------------
void UnityMessage(const char* msg, const UNITY_LINE_TYPE line)
{
UnityTestResultsBegin(Unity.TestFile, line);
UnityPrint("INFO");
if (msg != NULL)
{
UNITY_OUTPUT_CHAR(':');
UNITY_OUTPUT_CHAR(' ');
UnityPrint(msg);
}
UNITY_PRINT_EOL();
}
/*-----------------------------------------------*/
void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum)
{

View File

@@ -102,11 +102,13 @@ int suiteTearDown(int num_failures);
#define TEST_FAIL() UNITY_TEST_FAIL(__LINE__, NULL)
#define TEST_IGNORE_MESSAGE(message) UNITY_TEST_IGNORE(__LINE__, (message))
#define TEST_IGNORE() UNITY_TEST_IGNORE(__LINE__, NULL)
#define TEST_MESSAGE(message) UnityMessage((message), __LINE__)
#define TEST_ONLY()
/* It is not necessary for you to call PASS. A PASS condition is assumed if nothing fails.
* This method allows you to abort a test immediately with a PASS state, ignoring the remainder of the test. */
#define TEST_PASS() TEST_ABORT()
#define TEST_PASS_MESSAGE(message) do { UnityMessage((message), __LINE__); TEST_ABORT(); } while(0)
/* This macro does nothing, but it is useful for build tools (like Ceedling) to make use of this to figure out
* which files should be linked to in order to perform a test. Use it like TEST_FILE("sandwiches.c") */

View File

@@ -614,8 +614,8 @@ void UnityAssertNumbersArrayWithin(const UNITY_UINT delta,
const UNITY_FLAGS_T flags);
void UnityFail(const char* message, const UNITY_LINE_TYPE line);
void UnityIgnore(const char* message, const UNITY_LINE_TYPE line);
void UnityMessage(const char* message, const UNITY_LINE_TYPE line);
#ifndef UNITY_EXCLUDE_FLOAT
void UnityAssertFloatsWithin(const UNITY_FLOAT delta,