test: add remaining matchesWriteSignature near-miss coverage (#162)#196
Draft
sonupreetam wants to merge 2 commits into
Draft
test: add remaining matchesWriteSignature near-miss coverage (#162)#196sonupreetam wants to merge 2 commits into
sonupreetam wants to merge 2 commits into
Conversation
…nbound-force#162) - MapMutation/SliceMutation tests now assert exact count (1) and correct target name ("m"/"s") instead of boolean presence checks. - Add PartialResponseWriter fixture (Write+Header, no WriteHeader) to verify WriterOutput is emitted but HTTPResponseWrite is not. - Add WrongWriteReturn fixture (Write returns int, not (int, error)) to verify neither WriterOutput nor HTTPResponseWrite is emitted. Refs unbound-force#146 Refs unbound-force#162 Signed-off-by: sonupreetam <spreetam@redhat.com>
…-force#162) - Add 3 near-miss Write signature fixtures: WrongParamType (string param), WrongIntReturn64 (int64 return), ExtraParamWrite (extra param). - Add integration tests verifying none produce WriterOutput or HTTPResponseWrite, with explicit len(effects)==0 guards. - Add table-driven unit test for matchesWriteSignature via export_test.go, covering valid signature, all near-miss variants, and degenerate cases. Closes unbound-force#162 Signed-off-by: sonupreetam <spreetam@redhat.com>
3 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.
Summary
Stacked on #193. Completes the remaining test coverage requested in #162 (the partial coverage from #193 is noted in a comment).
Integration tests (3 new fixtures + tests)
WrongParamTypeWrite(string) (int, error)WrongIntReturn64Write([]byte) (int64, error)ExtraParamWriteWrite([]byte, int) (int, error)Each test asserts
len(effects) == 0(non-vacuous) plus explicit!hasEffectchecks for bothHTTPResponseWriteandWriterOutput.Internal unit test for
matchesWriteSignatureTable-driven test (
p1effects_internal_test.go) constructs synthetic*types.Signaturevalues to exercisematchesWriteSignaturedirectly — no package loading needed. Covers:Write([]byte) (int, error)→ trueWrite(string) (int, error)→ falseWrite([]byte) (int64, error)→ falseWrite([]byte, int) (int, error)→ falseWrite([]byte) int→ falseWrite() (int, error)→ falseWrite([]byte)→ falseTest plan
go test -race -count=1 -short ./internal/analysis/passesCloses #162