test(strbuf): cover the length-bounded contract of ffStrbufMatchSeparatedNS - #2585
Open
buyua9 wants to merge 1 commit into
Open
test(strbuf): cover the length-bounded contract of ffStrbufMatchSeparatedNS#2585buyua9 wants to merge 1 commit into
buyua9 wants to merge 1 commit into
Conversation
…atedNS ffStrbufMatchSeparatedNS takes an explicit compLength and is the length-bounded variant behind ffStrbufMatchSeparatedS; the Linux keyboard handler calls it with a fixed-size buffer length rather than a NUL-terminated string. tests/strbuf.c only exercised the S wrapper, so the bounded contract had no coverage: bounds cutting mid-token, compLength=0, embedded NUL inside bounds, and empty-substring matching were all untested, and a regression in the bounded path would keep every existing test green. Add a focused block asserting twelve length-boundary cases.
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.
What does this PR do?
Adds a focused test block for
ffStrbufMatchSeparatedNS, the length-bounded variant behindffStrbufMatchSeparatedS.Why
The Linux keyboard handler calls the NS variant with a fixed-size buffer length rather than a NUL-terminated string, but
tests/strbuf.conly exercised the S wrapper — the bounded contract had zero coverage. The new block asserts twelve length-boundary cases: bounds cutting mid-token (match vs no-match),compLength = 0, a bound spanning exactly one token, no separator in bounds, an embedded NUL inside the bounds, and empty-substring matching, all against the current implementation semantics.Tested
cmake -DFF_BUILD_TESTS=on→ffstrbuf_test(block verified against the implementation's branch behavior; full suite runs in CI).