# Test Coverage Summary
## Overview
All source modules have corresponding test files with comprehensive coverage.
## Source Files and Test Coverage
| `audit.rs` | `audit_tests.rs` | ✅ | 4 tests |
| `executor.rs` | `executor_tests.rs` | ✅ | 24 tests |
| `help.rs` | `help_tests.rs` | ✅ | 11 tests |
| `list.rs` | `list_tests.rs` | ✅ | 13 tests |
| `make.rs` | `make_tests.rs` | ✅ | 7 tests |
| `rename.rs` | `rename_tests.rs` | ✅ | 6 tests |
| `subcommands.rs` | `subcommands_tests.rs` | ✅ | 20 tests |
| `template.rs` | `template_tests.rs` | ✅ | 8 tests |
| `templates.rs` | `templates_tests.rs` | ✅ | 8 tests |
| `ui.rs` | `ui_tests.rs` | ✅ | 6 tests |
| `undo.rs` | `undo_tests.rs` | ✅ | 2 tests |
| `validate.rs` | `validate_tests.rs` | ✅ | 6 tests |
| `main.rs` | `integration_tests.rs` | ✅ | 60 tests (via binary) |
| `lib.rs` | N/A | N/A | (module declarations only) |
## Test Files Summary
### Unit Tests
- **audit_tests.rs**: Tests audit log functionality
- **executor_tests.rs**: Tests command execution orchestration, validation, config extraction, template resolution
- **help_tests.rs**: Tests help text output for all subcommands
- **list_tests.rs**: Tests file finding, pattern matching, recursion, exclusion
- **make_tests.rs**: Tests preview generation with various patterns
- **rename_tests.rs**: Tests file renaming with various options
- **subcommands_tests.rs**: Tests command parsing, flag extraction
- **template_tests.rs**: Tests template management and usage
- **templates_tests.rs**: Tests template registry functionality
- **ui_tests.rs**: Tests preview display formatting
- **undo_tests.rs**: Tests undo functionality
- **validate_tests.rs**: Tests rename validation
### Integration Tests
- **integration_tests.rs**: End-to-end tests via binary execution (60 tests)
- **short_flag_tests.rs**: Tests short flag handling (11 tests)
## Total Test Count
**186 tests** across all test files
## Coverage by Module
### executor.rs (NEW)
- ✅ `validate_subcommand_combinations` - tested
- ✅ `extract_config` - tested (all subcommand types)
- ✅ `resolve_template_pattern` - tested (by name, by index, error cases)
- ✅ `get_audit_pattern` - tested (all combinations)
- ✅ `handle_standalone_commands` - tested (undo, audit, template --list, error cases)
- ⚠️ `execute_command_pipeline` - tested indirectly via integration tests
### help.rs (NEW)
- ✅ `print_main_help` - tested (no panic)
- ✅ `print_subcommand_help` - tested (all subcommands)
- ✅ All private `print_*_help` functions - tested via `print_subcommand_help`
## Notes
1. **executor.rs**: The `execute_command_pipeline` function is complex and orchestrates the entire command flow. It's tested indirectly through integration tests which exercise the full pipeline.
2. **help.rs**: Help functions print directly to stdout, so tests verify they don't panic and can be called. Full output verification would require stdout capture or integration tests.
3. **main.rs**: Entry point is tested via integration tests that execute the binary directly.
4. All test files follow consistent naming: `{module}_tests.rs`
## Running Tests
```bash
# Run all tests
cargo test
# Run specific test file
cargo test --test executor_tests
# Run with timeout (for hanging test detection)
./tests/run_tests_with_timeout.sh
```
## Test Utilities
- **test_utils.rs**: Shared utilities for test setup (temp directories, file creation, etc.)