Skip to content

test(strbuf): cover the length-bounded contract of ffStrbufMatchSeparatedNS - #2585

Open
buyua9 wants to merge 1 commit into
fastfetch-cli:devfrom
buyua9:test/strbuf-match-separated-ns-bounded
Open

test(strbuf): cover the length-bounded contract of ffStrbufMatchSeparatedNS#2585
buyua9 wants to merge 1 commit into
fastfetch-cli:devfrom
buyua9:test/strbuf-match-separated-ns-bounded

Conversation

@buyua9

@buyua9 buyua9 commented Sep 14, 2026

Copy link
Copy Markdown

What does this PR do?

Adds a focused test block for ffStrbufMatchSeparatedNS, the length-bounded variant behind ffStrbufMatchSeparatedS.

Why

The Linux keyboard handler calls the NS variant with a fixed-size buffer length rather than a NUL-terminated string, but tests/strbuf.c only 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=onffstrbuf_test (block verified against the implementation's branch behavior; full suite runs in CI).

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant