1
0
mirror of https://github.com/ThrowTheSwitch/Unity.git synced 2026-01-24 17:01:35 +01:00

Implement macro TEST_PRINTF: Works like TEST_MESSAGE, but with a format-string.

Depends on UnityPrintFormatted (define UNITY_INCLUDE_PRINT_FORMATTED).
UnityPrintFormatted has been renamed to UnityPrintF due to changes below.

API of UnityPrintFormatted has been changed (hence the rename), but end users
(developers) can use the TEST_PRINTF as an almost-drop-in replacement TEST_PRINTF
is compatible with the old UnityPrintFormatted API (see below).

The behaviour of UnityPrintF has also been changed:
  - Now it prefixes the outout with test location information Output is marked
    as INFO.
  - It adds an EOL.

Both behaviours adopted from other output functions.
This commit is contained in:
Jørn Villesen Christensen
2020-02-14 12:31:53 +01:00
parent c101cfa7d2
commit 3da0b4652c
3 changed files with 131 additions and 116 deletions

View File

@@ -104,6 +104,9 @@ void verifyTest(void);
#define TEST_IGNORE() UNITY_TEST_IGNORE(__LINE__, NULL)
#define TEST_MESSAGE(message) UnityMessage((message), __LINE__)
#define TEST_ONLY()
#ifdef UNITY_INCLUDE_PRINT_FORMATTED
#define TEST_PRINTF(message, ...) UnityPrintF(__LINE__, (message), __VA_ARGS__)
#endif
/* 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. */