refactor(rust): share test scaffolding via mergify-test-support crate#1439
Conversation
This was referenced May 19, 2026
Member
Author
|
This pull request is part of a Mergify stack:
|
This was referenced May 19, 2026
This was referenced May 19, 2026
Contributor
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🔴 ⛓️ Depends-On RequirementsWaiting for
This rule is failing.Requirement based on the presence of
🔴 👀 Review RequirementsWaiting for
This rule is failing.
🔴 🔎 ReviewsWaiting for
This rule is failing.
🟢 🤖 Continuous IntegrationWonderful, this rule succeeded.
🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 📕 PR descriptionWonderful, this rule succeeded.
|
721eacd to
a6bf822
Compare
32628b4 to
d7feae3
Compare
Member
Author
Revision history
|
Every command crate's test module re-rolled the same ~30 LOC of `SharedBytes` / `SharedWriter` / `Captured` / `make_output` glue — about 350 LOC of pure boilerplate across 15 files, drifting over time (some `Captured` had `stderr`, some didn't; one file even carried a `_stderr_accessor_lives` dead-code stub just to silence the resulting warning). Extract the canonical version into a new `mergify-test-support` crate that other crates pull in as a `dev-dependencies`. The new `Captured` API exposes `human()` / `new(mode)` constructors and `stdout()` / `stderr()` accessors, so the common pattern shrinks from a 12-line `String::from_utf8(cap.stdout.lock().unwrap().clone())` to `let s = cap.stdout()`. Net `-418 / +114` lines across the workspace. Behavior unchanged; all 233 tests pass. The crate is `publish = false` and only ever appears under `[dev-dependencies]`, so the test-only types never leak into a production build. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Change-Id: If9d688cdaf55360ba90f386d2020b52346c19b28
d7feae3 to
bdea5bb
Compare
a6bf822 to
ac72c27
Compare
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.
Every command crate's test module re-rolled the same ~30 LOC of
SharedBytes/SharedWriter/Captured/make_outputglue —about 350 LOC of pure boilerplate across 15 files, drifting over
time (some
Capturedhadstderr, some didn't; one file evencarried a
_stderr_accessor_livesdead-code stub just to silencethe resulting warning).
Extract the canonical version into a new
mergify-test-supportcrate that other crates pull in as a
dev-dependencies. The newCapturedAPI exposeshuman()/new(mode)constructors andstdout()/stderr()accessors, so the common pattern shrinksfrom a 12-line
String::from_utf8(cap.stdout.lock().unwrap().clone())to
let s = cap.stdout().Net
-418 / +114lines across the workspace. Behavior unchanged;all 233 tests pass.
The crate is
publish = falseand only ever appears under[dev-dependencies], so the test-only types never leak into aproduction build.
Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com
Depends-On: #1438