Repository navigation
Conversation
Contributor
|
thetic
force-pushed
the
captured-parameters
branch
from
September 10, 2026 04:32
fb8bb7d to
f6d69a4
Compare
Lets a test capture a parameter the code under test passes into a mocked call, for inspection after the call (a Mockito-style argument captor) -- the mirror of with_output_parameter, which only moves data test -> code under test. Reimplements the idea from long-stalled upstream CppUTest PR #785 with an explicit copy-direction tag instead of inferring it from which of two pointers is non-null, and with names that don't collide with this codebase's existing "input parameter" (compared, not copied) terminology. Claude-Session: https://claude.ai/code/session_01QtyJLf7njTtE2dXa2y6mC6
thetic
force-pushed
the
captured-parameters
branch
from
September 10, 2026 04:35
f6d69a4 to
d9a2730
Compare
with_captured_parameter/with_captured_parameter_of_type were inserted mid-vtable in ActualCall and ExpectedCall, shifting the slots of every virtual declared after them. abi_check.sh already detects this class of break; under semver rule #4 (major version zero) it requires a minor bump to allow it.
NamedValue::compatible_for_copying() treated any "void*" expected value as compatible with any "const void*" actual value purely by type string, without checking which direction the pair came from. with_output_parameter and with_captured_parameter store their raw-pointer form with the same two type strings but with the roles swapped, so pairing with_output_parameter() on one side with with_captured_parameter() on the other slipped through as a match, then failed later with a confusing "no way to copy custom type" error instead of a clear direction-mismatch diagnostic.
MockOutputParametersListNode used a void*/const void* union alongside its direction enum, and copy_output_parameters() repeated the same copier/memcpy/fail chain once per direction, differing only in which side was the source and which was the destination. Store a single const void* and branch just on direction where the source/destination actually swap, sharing everything else.
This branch has not been deployed
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.
Description
Adds
with_captured_parameter/with_captured_parameter_of_typeto the mock framework -- the mirror-image ofwith_output_parameter, letting a test capture a value the code under test passes into a mocked call and inspect it after the call (an argument-captor, like Mockito'sArgumentCaptoror gmock'sSaveArg). This fills a gapwith_parameter_of_type()can't: that method requires an exact match during the call, which doesn't work when the value can't be predicted ahead of time (a generated id, a timestamp, a struct the SUT populates).This reimplements the idea proposed in upstream CppUTest PR #785. That PR's diff isn't portable as-is:
MutinyCopyDirectiontag + union on the existing output-parameter list node instead.withInputParameterForwarding/withInputParameter) collides with this codebase's existing "input parameter" concept (input_parameters_,check_input_parameter,has_input_parameterall mean compared parameters, not copied ones). This PR useswith_captured_parameter[_of_type]on both sides instead.Related Issues
N/A
Type of Change
Manual Verification (Optional)
N/A
Checklist
docs/for any user-facing changes.mu::tinynamespace,INCLUDED_MU_TINY_guards,mutiny_C-prefix)..hand.c.cpp) is required for parity.CONTRIBUTING.mdfile to ensure compliance with architectural guidelines.