From aa3ca2d5728ed91a9f20581533f749b8b2e470df Mon Sep 17 00:00:00 2001 From: Michael Karlesky Date: Sat, 29 Jul 2023 20:20:33 -0400 Subject: [PATCH 1/2] Add/update build directives * Renamed macro `TEST_FILE()` to `TEST_SOURCE_FILE()` * Added macro `TEST_INCLUDE_PATH()` * Added full comment block for documentation --- src/unity.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/unity.h b/src/unity.h index e321a1d..d849a3f 100644 --- a/src/unity.h +++ b/src/unity.h @@ -113,9 +113,19 @@ void verifyTest(void); #define TEST_PASS() TEST_ABORT() #define TEST_PASS_MESSAGE(message) do { UnityMessage((message), __LINE__); TEST_ABORT(); } while (0) -/* This macro does nothing, but it is useful for build tools (like Ceedling) to make use of this to figure out - * which files should be linked to in order to perform a test. Use it like TEST_FILE("sandwiches.c") */ -#define TEST_FILE(a) +/*------------------------------------------------------- + * Build Directives + *------------------------------------------------------- + + * These macros do nothing, but they are useful for additional build context. + * Tools (like Ceedling) can scan for these directives and make use of them for + * per-test-executable #include search paths and linking. */ + +/* Add source files to a test executable's compilation and linking. Ex: TEST_SOURCE_FILE("sandwiches.c") */ +#define TEST_SOURCE_FILE(a) + +/* Customize #include search paths for a test executable's compilation. Ex: TEST_INCLUDE_PATH("src/module_a/inc") */ +#define TEST_INCLUDE_PATH(a) /*------------------------------------------------------- * Test Asserts (simple) From 5109be3881f5f2304e801b1df06a99157167cca7 Mon Sep 17 00:00:00 2001 From: Mike Karlesky Date: Tue, 15 Aug 2023 21:16:02 -0400 Subject: [PATCH 2/2] Missed renames of TEST_FILE() directive --- auto/generate_test_runner.rb | 2 +- test/testdata/testRunnerGeneratorSmall.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/auto/generate_test_runner.rb b/auto/generate_test_runner.rb index ace5930..30d4107 100755 --- a/auto/generate_test_runner.rb +++ b/auto/generate_test_runner.rb @@ -197,7 +197,7 @@ class UnityTestRunnerGenerator includes = { local: source.scan(/^\s*#include\s+\"\s*(.+\.#{@options[:include_extensions]})\s*\"/).flatten, system: source.scan(/^\s*#include\s+<\s*(.+)\s*>/).flatten.map { |inc| "<#{inc}>" }, - linkonly: source.scan(/^TEST_FILE\(\s*\"\s*(.+\.#{@options[:source_extensions]})\s*\"/).flatten + linkonly: source.scan(/^TEST_SOURCE_FILE\(\s*\"\s*(.+\.#{@options[:source_extensions]})\s*\"/).flatten } includes end diff --git a/test/testdata/testRunnerGeneratorSmall.c b/test/testdata/testRunnerGeneratorSmall.c index dc687ba..58bc65c 100644 --- a/test/testdata/testRunnerGeneratorSmall.c +++ b/test/testdata/testRunnerGeneratorSmall.c @@ -4,7 +4,7 @@ #include "unity.h" #include "Defs.h" -TEST_FILE("some_file.c") +TEST_SOURCE_FILE("some_file.c") /* Notes about prefixes: test - normal default prefix. these are "always run" tests for this procedure