Skip to content

macro: Add end-to-end test harness#30

Merged
moCello merged 2 commits into
mainfrom
mocello/266-macro-e2e-test-harness
May 18, 2026
Merged

macro: Add end-to-end test harness#30
moCello merged 2 commits into
mainfrom
mocello/266-macro-e2e-test-harness

Conversation

@moCello
Copy link
Copy Markdown
Member

@moCello moCello commented May 15, 2026

Resolves #29

moCello added 2 commits May 15, 2026 15:29
Cover the gap between unit tests of validation helpers and the single
end-to-end shape in tests/test-contract: trybuild compile-fail fixtures
pin every rejection rule in validate.rs, and a compile-pass sub-crate
pins valid contract shapes the reference contract does not exercise.

- Reorganize the 4 existing compile-fail fixtures under topic dirs
  (directives/, feature_gates/) and widen the trybuild glob to
  tests/compile-fail/**/*.rs.
- Add 20 compile-fail fixtures (methods/, traits/, events/), one per
  validate.rs rejection rule, each carrying a // Pins: header that
  traces back to the rule identifier.
- Add tests/compile-pass/ sub-crate with a topic-mirroring layout and
  a tests/compile_pass.rs driver that runs cargo check on it; the
  sub-crate is used (instead of trybuild's compile_pass glob) because
  the macro emits a compile_error! without a feature set and trybuild
  has no per-fixture feature configuration.
- Add tests/README.md covering the topic taxonomy, the // Pins: header
  convention, the rationale for the sub-crate layout, and the absence
  of _dd.rs (data-driver-js) variants.

Nothing in contract-macro/src/ or tests/test-contract/ is edited.
@moCello moCello requested a review from HDauven May 15, 2026 13:38
Copy link
Copy Markdown
Member

@HDauven HDauven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Great that we now have such an extensive test harness 👍

@moCello moCello merged commit 04607f2 into main May 18, 2026
2 checks passed
@moCello moCello deleted the mocello/266-macro-e2e-test-harness branch May 18, 2026 08:22
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.

End-to-end test harness for the #[contract] macro

2 participants