From ac3cde30f5257c13bffae48676a69d410dcb639f Mon Sep 17 00:00:00 2001 From: Roland Stahn <rstahn@users.noreply.github.com> Date: Sat, 21 Jul 2018 16:57:53 +0200 Subject: [PATCH] Added notes on _MESSAGE assertions (#331) Added notes, why _MESSAGE assertions do not support printf style formatting and how users can work around this limitation (see #331) --- docs/UnityAssertionsReference.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/UnityAssertionsReference.md b/docs/UnityAssertionsReference.md index 2dcf5e3..d569e76 100644 --- a/docs/UnityAssertionsReference.md +++ b/docs/UnityAssertionsReference.md @@ -104,6 +104,15 @@ becomes messageified like thus... TEST_ASSERT_X_MESSAGE( {modifiers}, {expected}, actual, {size/count}, message ) +Notes: +- The `_MESSAGE` variants intentionally do not support `printf` style formatting + since many embedded projects don't support or avoid `printf` for various reasons. + It is possible to use `sprintf` before the assertion to assemble a complex fail + message, if necessary. +- If you want to output a counter value within an assertion fail message (e.g. from + a loop) , building up an array of results and then using one of the `_ARRAY` + assertions (see below) might be a handy alternative to `sprintf`. + #### TEST_ASSERT_X_ARRAY Variants