From 3cbe49900a6f0b061be4b9d992632c3cdab7b23a Mon Sep 17 00:00:00 2001 From: Mark VanderVoord Date: Sun, 31 Mar 2024 18:12:31 -0400 Subject: [PATCH 1/6] Don't call assertions until after we've concluded test framework tinkering in core test (#718) --- test/tests/test_unity_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/tests/test_unity_core.c b/test/tests/test_unity_core.c index 094d48a5..6638fb94 100644 --- a/test/tests/test_unity_core.c +++ b/test/tests/test_unity_core.c @@ -300,8 +300,8 @@ void testFailureCountIncrementsAndIsReturnedAtEnd(void) startFlushSpy(); savedGetFlushSpyCalls = getFlushSpyCalls(); UnityConcludeTest(); - TEST_ASSERT_EQUAL(0, savedGetFlushSpyCalls); endPutcharSpy(); + TEST_ASSERT_EQUAL(0, savedGetFlushSpyCalls); TEST_ASSERT_EQUAL(savedFailures + 1, Unity.TestFailures); #if defined(UNITY_OUTPUT_FLUSH) && defined(UNITY_OUTPUT_FLUSH_HEADER_DECLARATION) TEST_ASSERT_EQUAL(1, getFlushSpyCalls()); From 0ace9d8273bb99b229a8e76bfab157896dee913c Mon Sep 17 00:00:00 2001 From: sdimovv <36302090+sdimovv@users.noreply.github.com> Date: Sun, 7 Apr 2024 02:57:16 +0100 Subject: [PATCH 2/6] Cast line_num to allow compilation with `-WConversion` --- auto/run_test.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auto/run_test.erb b/auto/run_test.erb index 68b33730..e334d657 100644 --- a/auto/run_test.erb +++ b/auto/run_test.erb @@ -2,7 +2,7 @@ static void run_test(UnityTestFunction func, const char* name, UNITY_LINE_TYPE line_num) { Unity.CurrentTestName = name; - Unity.CurrentTestLineNumber = line_num; + Unity.CurrentTestLineNumber = (UNITY_UINT) line_num; #ifdef UNITY_USE_COMMAND_LINE_ARGS if (!UnityTestMatches()) return; From 9b77170349e8ab025dac23dd37f0925bfe15e184 Mon Sep 17 00:00:00 2001 From: sdimovv <36302090+sdimovv@users.noreply.github.com> Date: Thu, 18 Apr 2024 14:25:55 +0100 Subject: [PATCH 3/6] Remove redundant line casts from `UNITY_TEST_ASSERT_*` macros --- src/unity_internals.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/unity_internals.h b/src/unity_internals.h index 1214bf07..ca962af1 100644 --- a/src/unity_internals.h +++ b/src/unity_internals.h @@ -875,11 +875,11 @@ int UnityTestMatches(void); * Test Asserts *-------------------------------------------------------*/ -#define UNITY_TEST_ASSERT(condition, line, message) do { if (condition) { /* nothing*/ } else { UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), (message)); } } while (0) -#define UNITY_TEST_ASSERT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) == NULL), (UNITY_LINE_TYPE)(line), (message)) -#define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) != NULL), (UNITY_LINE_TYPE)(line), (message)) -#define UNITY_TEST_ASSERT_EMPTY(pointer, line, message) UNITY_TEST_ASSERT(((pointer[0]) == 0), (UNITY_LINE_TYPE)(line), (message)) -#define UNITY_TEST_ASSERT_NOT_EMPTY(pointer, line, message) UNITY_TEST_ASSERT(((pointer[0]) != 0), (UNITY_LINE_TYPE)(line), (message)) +#define UNITY_TEST_ASSERT(condition, line, message) do { if (condition) { /* nothing*/ } else { UNITY_TEST_FAIL((line), (message)); } } while (0) +#define UNITY_TEST_ASSERT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) == NULL), (line), (message)) +#define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) != NULL), (line), (message)) +#define UNITY_TEST_ASSERT_EMPTY(pointer, line, message) UNITY_TEST_ASSERT(((pointer[0]) == 0), (line), (message)) +#define UNITY_TEST_ASSERT_NOT_EMPTY(pointer, line, message) UNITY_TEST_ASSERT(((pointer[0]) != 0), (line), (message)) #define UNITY_TEST_ASSERT_EQUAL_INT(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(expected), (UNITY_INT)(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT) #define UNITY_TEST_ASSERT_EQUAL_INT8(expected, actual, line, message) UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )(expected), (UNITY_INT)(UNITY_INT8 )(actual), (message), (UNITY_LINE_TYPE)(line), UNITY_DISPLAY_STYLE_INT8) From e6f73b6ad0d7d42c7b60b2b9dd9317eb9dd54080 Mon Sep 17 00:00:00 2001 From: "Mr.UNIX" <99476714+mrunix00@users.noreply.github.com> Date: Fri, 26 Apr 2024 16:59:59 +0100 Subject: [PATCH 4/6] Update the year in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 71488b3e..2ebf988e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Unity Test ![CI][] -__Copyright (c) 2007 - 2023 Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams__ +__Copyright (c) 2007 - 2024 Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams__ Welcome to the Unity Test Project, one of the main projects of ThrowTheSwitch.org. Unity Test is a unit testing framework built for C, with a focus on working with embedded toolchains. From 5ff17d6542684c146fbffd0d0509f925b34a17dc Mon Sep 17 00:00:00 2001 From: mchernosky Date: Fri, 26 Apr 2024 12:46:49 -0600 Subject: [PATCH 5/6] Label as static internal functions enabled by UNITY_USE_COMMAND_LINE_ARGS to prevent -Werror=missing-declarations --- src/unity.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/unity.c b/src/unity.c index 7fd703ab..c91c3853 100644 --- a/src/unity.c +++ b/src/unity.c @@ -2351,7 +2351,7 @@ int UnityParseOptions(int argc, char** argv) } /*-----------------------------------------------*/ -int IsStringInBiggerString(const char* longstring, const char* shortstring) +static int IsStringInBiggerString(const char* longstring, const char* shortstring) { const char* lptr = longstring; const char* sptr = shortstring; @@ -2396,7 +2396,7 @@ int IsStringInBiggerString(const char* longstring, const char* shortstring) } /*-----------------------------------------------*/ -int UnityStringArgumentMatches(const char* str) +static int UnityStringArgumentMatches(const char* str) { int retval; const char* ptr1; From 8e4c9b94cb334cc9c20217eb0d36f5ee8805a442 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding-555@users.noreply.github.com> Date: Tue, 30 Apr 2024 14:24:34 -0600 Subject: [PATCH 6/6] Update main.yml --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 339bd23a..f0b6d930 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,7 +27,7 @@ jobs: # Checks out repository under $GITHUB_WORKSPACE - name: Checkout Latest Repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 # Run Tests - name: Run All Unit Tests