mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-01-23 00:15:58 +01:00
Merge pull request #211 from jsalling/feature/testunity-fail-output
Make testunity.c failure output uniform
This commit is contained in:
@@ -42,12 +42,13 @@ intDetection:
|
||||
$(BUILD_DIR)/testunityRunner.c: tests/testunity.c | $(BUILD_DIR)
|
||||
awk $(AWK_SCRIPT) tests/testunity.c > $@
|
||||
|
||||
AWK_SCRIPT='/^void test/{ declarations[d++]=$$0; gsub(/\(?void\)? ?/,""); tests[t++]=$$0 } \
|
||||
END{ print "\#include \"unity.h\" //Autogenerated by awk in Makefile" ; \
|
||||
for (i=0; i<d; i++) { print declarations[i] ";" } \
|
||||
printf "int main()\n{\n UNITY_BEGIN();\n" ; \
|
||||
for (i=0; i<t; i++) { print " RUN_TEST(" tests[i] ");" } \
|
||||
printf " return UNITY_END();\n}\n" }'
|
||||
AWK_SCRIPT=\
|
||||
'/^void test/{ declarations[d++]=$$0; gsub(/\(?void\)? ?/,""); tests[t++]=$$0; line[u++]=NR } \
|
||||
END{ print "\#include \"unity.h\" /* Autogenerated by awk in Makefile */" ; \
|
||||
for (i=0; i<d; i++) { print declarations[i] ";" } \
|
||||
printf "int main(void)\n{\n UNITY_BEGIN();\n" ; \
|
||||
for (i=0; i<t; i++) { print " RUN_TEST(" tests[i] ", " line[i] ");" } \
|
||||
printf " return UNITY_END();\n}\n" }'
|
||||
|
||||
$(BUILD_DIR):
|
||||
mkdir -p $(BUILD_DIR)
|
||||
|
||||
@@ -30,7 +30,7 @@ static const _UD d_zero = 0.0;
|
||||
UnityPrintNumberUnsigned(Unity.CurrentTestLineNumber); \
|
||||
UNITY_OUTPUT_CHAR(':'); \
|
||||
UnityPrint(Unity.CurrentTestName); \
|
||||
UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \
|
||||
UnityPrint(":FAIL: [[[[ Test Should Have Failed But Did Not ]]]]"); \
|
||||
UNITY_OUTPUT_CHAR('\n'); \
|
||||
}
|
||||
|
||||
@@ -40,7 +40,10 @@ static const _UD d_zero = 0.0;
|
||||
Unity.CurrentTestIgnored = 0; \
|
||||
if (Unity.CurrentTestFailed == 1) { \
|
||||
SetToOneMeanWeAlreadyCheckedThisGuy = 1; \
|
||||
UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \
|
||||
UnityPrintNumberUnsigned(Unity.CurrentTestLineNumber); \
|
||||
UNITY_OUTPUT_CHAR(':'); \
|
||||
UnityPrint(Unity.CurrentTestName); \
|
||||
UnityPrint(":FAIL: [[[[ Test Should Have Ignored But Did Not ]]]]"); \
|
||||
UNITY_OUTPUT_CHAR('\n'); \
|
||||
}
|
||||
|
||||
@@ -59,7 +62,7 @@ void tearDown(void)
|
||||
TEST_FAIL_MESSAGE("<= Failed in tearDown");
|
||||
if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0))
|
||||
{
|
||||
UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]");
|
||||
UnityPrint(": [[[[ Test Should Have Passed But Did Not ]]]]");
|
||||
UNITY_OUTPUT_CHAR('\n');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user