fix(doubles): add a boundary-exact spy argument assertion - #903
Merged
Chemaclass merged 1 commit intoJul 27, 2026
Merged
Conversation
`assert_have_been_called_with` compares against the spy's space-joined `raw` field, so `cmd "a b"` is indistinguishable from `cmd a b` and a quoting bug passes the assertion. The spy already recorded a per-argument form, but it was unusable: the separator was written as the literal text `$'\x1f'` rather than the byte (ANSI-C quoting does not apply inside double quotes), and the trailing-separator strip therefore never matched. No assertion read the field, so nobody noticed. Fix the separator and add `assert_have_been_called_with_args <spy> <arg>...`, which serializes the expected arguments the same way and compares them one by one. `assert_have_been_called_with` is unchanged. The new assertion takes no call index: a trailing number could not be told apart from a numeric argument. Closes #894
Chemaclass
deleted the
fix/894-assert-have-been-called-with-arg-boundaries
branch
July 27, 2026 19:29
5 tasks
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.
🤔 Background
Related #894
assert_have_been_called_withcompares against the spy's space-joined record, socmd "a b"andcmd a blook identical to it. A quoting bug in the code under test therefore produces a green assertion — the worst kind of false positive.💡 Changes
assert_have_been_called_with_args <spy> <arg>..., which compares the recorded arguments one by one. No call index: a trailing number could not be told apart from a numeric argument.assert_have_been_called_withbehaviour is unchanged.