Skip to content

analysis(rust): recognize explicit nonstandard test-defining attributes #3499

Closed

Description

@EffortlessSteven

Problem

Rust test discovery currently recognizes only #[test], #[tokio::test], #[async_std::test], and #[rstest]. The parser-backed and lexical-fallback producers each carry their own spelling checks, so they can drift and the prefix-based fallback can also accept lookalike attributes.

That leaves several explicit, source-visible test styles classified as ordinary functions instead of evidence:

  • QuickCheck property functions using #[quickcheck];
  • browser/Wasm tests using #[wasm_bindgen_test];
  • parameterized tests using #[test_case] or #[test_matrix];
  • path-qualified forms such as #[rstest::rstest] and #[quickcheck_macros::quickcheck].

The effect is upstream of related-test scoring: no TestFact is produced, and changed code inside the function can be treated as a production subject.

Required outcome

Add one internal exact test-attribute classifier and use it from both the parser-backed and lexical Rust syntax producers.

Recognize the existing forms plus these explicit test-defining families:

test
tokio::test
async_std::test
rstest / rstest::rstest
quickcheck / quickcheck_macros::quickcheck
wasm_bindgen_test / wasm_bindgen_test::wasm_bindgen_test
test_case / test_case::test_case / ntest::test_case
test_matrix / test_case::test_matrix

Parameterized source functions remain one source-level TestFact; RIPR does not claim to enumerate macro-expanded generated cases.

Acceptance

  • Parser-backed indexing emits TestFact and FunctionFact.is_test = true for every supported family.
  • Lexical fallback recognizes the same family, including argument-bearing and whitespace-varied forms.
  • Existing #[test], Tokio, async-std, and rstest behavior remains unchanged.
  • Prefix lookalikes such as #[rstest_helper], #[tokio::test_helper], #[test_case_helper], and #[quickcheck_config] remain ordinary attributes.
  • Unannotated helpers in test files remain helpers rather than executable tests.
  • Focused tests exercise both producers and the shared classifier.

Non-goals

  • no macro expansion or generated-case enumeration;
  • no proptest!, quickcheck!, custom harness, libtest-mimic, or arbitrary user-defined attribute discovery;
  • no cfg_attr evaluation or import-resolution proof for ambiguous custom macros;
  • no assertion/oracle-strength change, output schema change, support-tier promotion, or runtime test execution.

Proof direction

cargo test -p ripr --lib analysis::syntax -- --nocapture
cargo fmt --all -- --check
cargo clippy -p ripr --lib --tests -- -D warnings
cargo xtask precommit
git diff --check

Claim boundary

Completion lets RIPR treat the named explicit attribute-macro styles as source-level Rust tests in both normal parsing and syntax-error fallback. It does not establish arbitrary framework support or runtime adequacy.

Activity

  1. EffortlessSteven commented on Aug 28, 2026

    @EffortlessSteven
    MemberAuthor

    Source-role train integration

    This issue is the canonical owner for exact named test-defining attributes across the parser-backed and lexical-fallback producers.

    The implementation should therefore expose one exact internal classifier API rather than leave family-specific spelling checks in either producer. If #3519 contains an acceptance detail absent from this body, carry that detail into the shared classifier/tests rather than creating a second production path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions