Workspace is a tool suite for file operations, version management, and development workflow automation. Includes refactor (string replacement), scrap (local trash folder), unscrap (file restoration), and state (automatic versioning).
Workspace maintains reliability and safety through comprehensive testing.
cargo test # Run all tests
cargo test --lib # Run unit tests only
cargo test --test <SUITE> # Run specific integration suite
cargo test -- --nocapture # With output
| Test Suite | Focus Area |
|---|---|
Unit tests (in src/) |
Core logic: version calculation, alias derivation, template rendering, state management, entity models |
| integration_tests.rs | End-to-end workflows across tools |
| refac_concurrency_tests.rs | Multi-threading safety, race conditions |
| refac_edge_cases_tests.rs | Deep nesting, special characters, unicode |
| refac_empty_directory_tests.rs | Directory handling, permissions |
| refac_encoding_tests.rs | UTF-8, BOM, invalid encodings |
| scrap_advanced_integration_tests.rs | Archive, search, metadata |
| scrap_integration_tests.rs | Basic scrap/unscrap operations |
| state_integration_tests.rs | Version management, git hooks |
| state_template_tests.rs | Template rendering and management |
| code_analysis_tests.rs | AST parsing and code analysis |
| entity_manager_tests.rs | Entity CRUD operations |
| database_system_tests.rs | Database operations |
Every refactor operation undergoes validation before execution:
Files are processed before directories to prevent path invalidation. Deepest paths are processed first when renaming.
Binary files are automatically detected and skipped. UTF-8 validation prevents crashes on invalid encodings.
Rust’s ownership model provides compile-time guarantees:
When adding new features:
#[test]
fn test_specific_scenario() {
let temp_dir = TempDir::new().unwrap();
// Arrange: Set up test environment
// Act: Execute the operation
// Assert: Verify expected outcomes
// Cleanup handled automatically by TempDir
}