cargo-extract-test
A Cargo subcommand to extract, compile and run a single test function in isolation.
๐ Purpose
cargo-extract-test allows you to:
Extract a specific test function from your project.
Compile and run it in isolation using cargo test --test.
Quickly debug or isolate failing tests without compiling and running the entire test suite.
โ๏ธ Installation
Option 1: Local Installation
๐งช Usage
To extract and run a specific test function:
For example:
This command:
Extracts my_test_function into a temporary test file.
Runs it using cargo test --test __temp_test, passing any additional arguments.
๐ How It Works
The tool searches your project's source and test directories for the specified test function.
It copies the test function and any necessary use statements into a temporary file.
It compiles and runs the test in isolation, providing immediate feedback.
๐ฆ Dependencies
walkdir: For recursively searching directories.
๐งช Example
Given a test function:
Running:
Will extract and run my_test_function in isolation.
๐ License
This project is licensed under the MIT License.