| Crates.io | workspacer-mock |
| lib.rs | workspacer-mock |
| version | 0.5.2 |
| created_at | 2025-02-09 04:22:02.199091+00 |
| updated_at | 2025-07-13 00:23:57.649643+00 |
| description | Asynchronous Rust crate for creating mock workspaces with customizable crate configurations and error simulation for testing. |
| homepage | |
| repository | https://github.com/klebs6/klebs-general |
| max_upload_size | |
| id | 1548649 |
| size | 154,620 |
workspacer-mock is a robust Rust crate designed to facilitate the creation and manipulation of mock Rust workspaces for development and testing purposes. Leveraging asynchronous programming principles, it allows users to programmatically generate workspaces with customizable crate configurations.
Using MockPath and MockCrateHandle, developers can define the structure and readiness of their crates. The create_mock_workspace function generates a temporary workspace, executing tasks such as directory creation and Cargo.toml configuration, while allowing for the addition of basic files as needed. The crate supports the ReadyForCargoPublish trait to assess the readiness of the workspace for cargo operations.
To utilize workspacer-mock, include it as a dependency in your project. Enjoy the convenience of automated workspace setup suited for both simple and complex testing scenarios.
// Example usage
use workspacer_mock::{create_mock_workspace, MockPath, MockCrateHandle};
// Define your crate configurations
let crate_configs = vec![]; // Populate with CrateConfig
// Create your mock workspace
let workspace_path = create_mock_workspace(crate_configs).await.expect("Failed to create workspace");
Contributions are welcome. The project is dual-licensed under MIT and Apache-2.0. For more details, visit the repository.