Skip to content

Document carbide-test-support's real idiom and trim the stale guidance #2693

@chet

Description

@chet

The table-test helper's module docs teach the form almost nobody uses. Across the tree, 710 of 734 scenarios! / value_scenarios! calls use the run = |closure| form; only 24 use the fn_path: form the header examples lead with. And the closing "What's shared, and what stays a convention" paragraph prescribes a local struct Case plus assert_outcome pattern that has zero uses anywhere -- the pattern people actually reach for on multi-input rows is a local named struct passed as the macro's input and destructured in the run = closure. STYLE_GUIDE.md already documents the right approach; only the crate's own module docs drifted.

This updates the carbide-test-support module docs to lead with the run = |row| ... form and to describe the real multi-input idiom, and trims the assert_outcome guidance down to what it is -- an escape hatch for a hand-written case body, not the common path. No code or call-site changes.

Scope

  • crates/test-support/src/lib.rs -- module-level doc comment: the header examples (currently lead with the fn_path: form) and the closing "What's shared, and what stays a convention" paragraph (roughly lines 18-180).
  • Add one run = |closure| example to the doctests so the dominant form is exercised.

Acceptance

  • The primary documented example uses the run = form.
  • The multi-input guidance describes the local-named-struct-as-input pattern; the assert_outcome mention is scoped to hand-written bodies.
  • cargo test --doc -p carbide-test-support passes. No non-doc changes.

Size: S

Part of #2692.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Task.

    Projects

    Status
    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions