From 01a907393a64df8845c29b9735ef04ab45a80ae2 Mon Sep 17 00:00:00 2001 From: Dom Postorivo Date: Sat, 20 Apr 2019 15:39:55 -0400 Subject: [PATCH] silent mode in unity fixture --- extras/fixture/src/unity_fixture.c | 30 ++++++++++++++++---- extras/fixture/src/unity_fixture_internals.h | 1 + 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/extras/fixture/src/unity_fixture.c b/extras/fixture/src/unity_fixture.c index 2771198..0a16f6c 100644 --- a/extras/fixture/src/unity_fixture.c +++ b/extras/fixture/src/unity_fixture.c @@ -79,15 +79,21 @@ void UnityTestRunner(unityfunction* setup, Unity.TestFile = file; Unity.CurrentTestName = printableName; Unity.CurrentTestLineNumber = line; - if (!UnityFixture.Verbose) - UNITY_OUTPUT_CHAR('.'); - else + if (UnityFixture.Verbose) { UnityPrint(printableName); #ifndef UNITY_REPEAT_TEST_NAME Unity.CurrentTestName = NULL; #endif } + else if (UnityFixture.Silent) + { + /* Do Nothing */ + } + else + { + UNITY_OUTPUT_CHAR('.'); + } Unity.NumberOfTests++; UnityMalloc_StartTest(); @@ -120,13 +126,19 @@ void UnityIgnoreTest(const char* printableName, const char* group, const char* n { Unity.NumberOfTests++; Unity.TestIgnores++; - if (!UnityFixture.Verbose) - UNITY_OUTPUT_CHAR('!'); - else + if (UnityFixture.Verbose) { UnityPrint(printableName); UNITY_PRINT_EOL(); } + else if (UnityFixture.Silent) + { + /* Do Nothing */ + } + else + { + UNITY_OUTPUT_CHAR('!'); + } } } @@ -350,6 +362,7 @@ int UnityGetCommandLineOptions(int argc, const char* argv[]) { int i; UnityFixture.Verbose = 0; + UnityFixture.Silent = 0; UnityFixture.GroupFilter = 0; UnityFixture.NameFilter = 0; UnityFixture.RepeatCount = 1; @@ -364,6 +377,11 @@ int UnityGetCommandLineOptions(int argc, const char* argv[]) UnityFixture.Verbose = 1; i++; } + else if (strcmp(argv[i], "-s") == 0) + { + UnityFixture.Silent = 1; + i++; + } else if (strcmp(argv[i], "-g") == 0) { i++; diff --git a/extras/fixture/src/unity_fixture_internals.h b/extras/fixture/src/unity_fixture_internals.h index 00cee88..98d4d44 100644 --- a/extras/fixture/src/unity_fixture_internals.h +++ b/extras/fixture/src/unity_fixture_internals.h @@ -16,6 +16,7 @@ extern "C" struct UNITY_FIXTURE_T { int Verbose; + int Silent; unsigned int RepeatCount; const char* NameFilter; const char* GroupFilter; -- GitLab