Repository navigation
test(channels): make the docs-target invariant's own failure paths covered - #785
Merged
Merged
Conversation
…vered The invariant added in #784 carried four uncovered lines: its three `assert!` messages and the `panic!` arm only materialise when the check fails, so a passing suite never executes them. Worse, the negative controls that did exercise them were throwaway edits — I confirmed the check works by breaking it by hand and then put the file back, which leaves nothing behind that keeps working. Both problems have one fix: take the definitions as an argument and give each failure mode a test that sees it fail. * `docs_problem(root, docs)` returns why a target leads nowhere, or `None`; * `undocumented(definitions, root)` collects them — parameterised, so a definition can be built per case; * `a_docs_target_is_rejected_when_it_cannot_be_followed` covers all four shapes: a resolvable path, a resolvable path with a valid anchor, a file that is not there, an anchor that is not there, and an empty value. The assertions name the channel in the message, which is what makes the failure actionable. The three remaining uncovered lines were the multi-line `assert!` format arguments, evaluated only on failure; hoisting each into a binding ahead of the assert closes them. `an_anchor_is_the_slug_github_makes` pins the slug rule directly, including the two real cases that make it non-obvious (`### \`feishu\`` → `feishu`, `### iMessage (macOS)` → `imessage-macos`), so the anchor half of the check does not depend on the page staying the way it is today. `providers/mod.rs` is back to zero uncovered lines and the crate's total is unchanged at 47 (22 framework, 25 in the older Feishu/DingTalk bridges and gRPC client), which is the number `docs/architecture/channels-test-coverage.md` records.
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.
test(channels): make the docs-target invariant's own failure paths covered
The invariant added in #784 carried four uncovered lines: its three
assert!messages and the
panic!arm only materialise when the check fails, so apassing suite never executes them. Worse, the negative controls that did
exercise them were throwaway edits — I confirmed the check works by breaking it
by hand and then put the file back, which leaves nothing behind that keeps
working.
Both problems have one fix: take the definitions as an argument and give each
failure mode a test that sees it fail.
docs_problem(root, docs)returns why a target leads nowhere, orNone;undocumented(definitions, root)collects them — parameterised, so adefinition can be built per case;
a_docs_target_is_rejected_when_it_cannot_be_followedcovers all fourshapes: a resolvable path, a resolvable path with a valid anchor, a file that
is not there, an anchor that is not there, and an empty value. The assertions
name the channel in the message, which is what makes the failure actionable.
The three remaining uncovered lines were the multi-line
assert!formatarguments, evaluated only on failure; hoisting each into a binding ahead of the
assert closes them.
an_anchor_is_the_slug_github_makespins the slug rule directly, including thetwo real cases that make it non-obvious (
### \feishu`→feishu,### iMessage (macOS)→imessage-macos`), so the anchor half of the check doesnot depend on the page staying the way it is today.
providers/mod.rsis back to zero uncovered lines and the crate's total isunchanged at 47 (22 framework, 25 in the older Feishu/DingTalk bridges and gRPC
client), which is the number
docs/architecture/channels-test-coverage.mdrecords.