Description
In generator.rb (line 155, tag v1.1.0-pre.1), the reject block that is intended to remove vendor files from runner #include directives has inverted logic. The ! negation causes reject to keep only vendor files and remove all test file headers from generated runners.
Comment says: "Further filter others to remove vendor files"
others = includes.reject do |include| !VENDORS_FILES.include?( include.filename.ext() ) # BUG: negation inverts the filter
reject { |x| !VENDORS_FILES.include?(...) } is logically equivalent to select { |x| VENDORS_FILES.include?(...) }
The opposite of the stated intent.
Example
Test File
test_a.c
#include "unity.h"
#include "my_project_header.h"
#include "mock_some_header.h"
Generated Runner
test_a_runner.c
#include "unity.h"
/* MISSING PROJECT HEADER INCLUDE */
#include "mock_some_header.h"
Impact
When :use_test_preprocessor: :mocks is configured, generated test runners do not #include the test file project includes. Any constants defined in the project header file(s) are unresolved, causing compilation failures across the entire test suite:
Steps to Reproduce
Use Ceedling v1.1.0-pre.1 (commit 7c2cd26)
- Configure a project with:
:project: :use_test_preprocessor: :mocks
- Create a test file with project-specific includes
- Run
ceedling test:all
- Observe missing project-specific includes in the runner, and resulting compilation errors.
Expected Behavior
The generated test runner includes all non-vendor headers (test file headers, mock headers, application headers). Vendor files are filtered out since Unity's runner generator adds them itself.
Actual Behavior
The generated test runner includes only vendor headers and strips all project-specific headers, breaking any test that relies on constants, macros, or declarations from its own header.
Fix
Remove the erroneous ! negation:
# Further filter others to remove vendor files
others = includes.reject do |include|
- !VENDORS_FILES.include?( include.filename.ext() )
+ VENDORS_FILES.include?( include.filename.ext() )
end
Environment
Ceedling v1.1.0-pre.1 (commit 7c2cd26)
Ruby 3.3.0
gcc-9 / Linux x86_64
CMock 2.6.1, Unity 2.6.3
Description
In generator.rb (line 155, tag v1.1.0-pre.1), the reject block that is intended to remove vendor files from runner #include directives has inverted logic. The
!negation causesrejectto keep only vendor files and remove all test file headers from generated runners.Comment says: "Further filter others to remove vendor files"
reject { |x| !VENDORS_FILES.include?(...) }is logically equivalent toselect { |x| VENDORS_FILES.include?(...) }The opposite of the stated intent.
Example
Test File
test_a.cGenerated Runner
test_a_runner.cImpact
When
:use_test_preprocessor: :mocksis configured, generated test runners do not #include the test file project includes. Any constants defined in the project header file(s) are unresolved, causing compilation failures across the entire test suite:Steps to Reproduce
Use Ceedling v1.1.0-pre.1 (commit 7c2cd26)
:project: :use_test_preprocessor: :mocksceedling test:allExpected Behavior
The generated test runner includes all non-vendor headers (test file headers, mock headers, application headers). Vendor files are filtered out since Unity's runner generator adds them itself.
Actual Behavior
The generated test runner includes only vendor headers and strips all project-specific headers, breaking any test that relies on constants, macros, or declarations from its own header.
Fix
Remove the erroneous ! negation:
Environment
Ceedling v1.1.0-pre.1 (commit 7c2cd26)
Ruby 3.3.0
gcc-9 / Linux x86_64
CMock 2.6.1, Unity 2.6.3