Add subtractive notation to TEST_SOURCE_FILE() - #1214
Merged
Conversation
TEST_SOURCE_FILE() only ever added a file to a test executable's build. A test file that both #includes a header and separately names a same-basename source could already override the implicit header/source convention, but there was no way to remove a file that convention pulls in for any other reason -- for instance, a same-named file elsewhere in the project whose symbols conflict with what a test actually needs. A "-:" prefix on an entry now removes the named file from a test's final compile/link list outright, using the same +:/-: notation already available for :paths list entries. Unlike the existing override, removal applies to the fully assembled list regardless of how a file got there -- the implicit convention, a positive TEST_SOURCE_FILE() entry, or a Partial -- and is logged the same way the override already is. Collection, validation, and additive/subtractive resolution for this directive were previously split between TestBuildExecutor and TestBuildPlanner. They're now owned by one dedicated class, TestSourceFileDirectiveResolver, with its own focused test coverage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TEST_SOURCE_FILE()only ever added a file to a test executable's build. A test file that both#includes a header and separately names a same-basename source could already override the implicit header/source convention, but there was no way to remove a file that convention pulls in for any other reason — for instance, a same-named file elsewhere in the project whose symbols conflict with what a test actually needs.-:prefix on an entry now removes the named file from a test's final compile/link list outright, using the same+:/-:notation already available for:pathslist entries.TEST_SOURCE_FILE()entry, or a Partial — and is logged the same way the override already is.TestBuildExecutorandTestBuildPlanner. They're now owned by one dedicated class,TestSourceFileDirectiveResolver, with its own focused test coverage.spec/system/test_source_file_directive_spec.rb.Test plan
spec/units/test_source_file_directive_resolver_spec.rbcovers#resolve,#validate!, and#remove_subtracteddirectly.spec/units/test_build_executor_spec.rbandspec/units/test_build_planner_spec.rbupdated for the delegation, plus new subtractive-specific scenarios in#extract_sources.spec/system/test_source_file_directive_spec.rb(5 scenarios) and the trimmedspec/system/implicit_source_header_correspondence_disambiguation_spec.rb(2 scenarios) both green via Docker (madsciencelab-plugins:v1.1.4).testing-guide/build-directives.md,testing-guide/conventions.md,configuration/reference/paths.md.