Small written in Rust test manager to improve quality of life working in tests/ui
test-manager <source> -n <new_name> -p <path> [OPTIONS]Required:
<source>- Source file (e.g.,issue-12345.rs)-n <new_name>- New filename (e.g.,custom_attr.rs)-p <path>- Subdirectory undertests/ui(e.g.,attributes)
test-manager -m <source1> <path1> <new_name1> <source2> <path2> <new_name2> ... [OPTIONS]Required:
-m, --multi- Enable multi-file mode- Triplets of:
<source> <path> <new_name>for each file to move
Options (available in both modes):
-s, --stderr- Remove old.stderrfile and regenerate with./x test --bless-c, --comment <TEXT>- Add//! <TEXT>doc comment at top of file-f, --fmt- Format file withrustfmt-R, --regression- Extract issue number from filename and add GitHub link comment-g, --git- Commit moves with git
# Basic move
test-manager issue-12345.rs -n custom_attr.rs -p attributes
# Regression test with stderr
test-manager issue-98765.rs -n proc_macro_span.rs -p proc-macro -R -s
# Full workflow with git commit
test-manager issue-54321.rs -n lifetime_bounds.rs -p lifetimes -s -f -c "Test description" -g# Move multiple files at once
test-manager -m \
issue-12345.rs attributes custom_attr.rs \
issue-67890.rs proc-macro proc_macro_span.rs \
issue-11111.rs lifetimes lifetime_bounds.rs
# Multi-file with options
test-manager -m \
issue-12345.rs attributes custom_attr.rs \
issue-67890.rs proc-macro proc_macro_span.rs \
-R -s -gThe tool operates in phases:
- Prepare: Parse arguments and prepare file operations
- Move: Move all files to their new locations
- Git Commit (if
-g): Commit the moves before applying other changes - Post-processing: Apply other operations (comments, formatting, stderr generation)
This ensures git history is clean when using the -g flag, as moves are committed separately from content changes.
All source files are expected to be in tests/ui/issues/ and will be moved to tests/ui/<path>/.
Each operation is a separate module in src/modules/. To add a new feature:
- Create
src/modules/your_feature.rswith your function - Add it to
src/modules/mod.rs - Add the flag to
Argsstruct inmain.rs - Call your function in
main.rs
Example adding a --backup flag:
// src/modules/backup.rs
pub fn create_backup(path: &str) -> Result<(), Box<dyn std::error::Error>> {
std::fs::copy(path, format!("{}.bak", path))?;
Ok(())
}
// In main.rs Args struct:
#[arg(short = 'b', long)]
backup: bool,
// In main() function:
if args.backup {
create_backup(&destination_path)?;
}