# Test Suite for sphinx_click_custom

## Overview

This directory contains a comprehensive test suite for the sphinx_click_custom Sphinx extension. The test suite was generated by AI ([Claude code](https://www.anthropic.com/claude-code)). I've spot-checked the tests but there may be errors or edge cases that need further investigation.

## Test Files

### Core Test Files (50 tests total)

| File                         | Tests | Purpose                                          |
| ---------------------------- | ----- | ------------------------------------------------ |
| `test_simple.py`             | 4     | Basic functionality, imports, and error handling |
| `test_formatting.py`         | 19    | Core formatting functions and Click integration  |
| `test_edge_cases.py`         | 17    | Edge cases, error conditions, and robustness     |
| `test_directive_simple.py`   | 6     | Directive functionality and extension setup      |
| `test_integration_simple.py` | 4     | Extension loading and module imports             |

### Support Files

- `conftest.py` - Pytest fixtures and test command definitions
- `__init__.py` - Package initialization

## Running Tests

```bash
# Run all tests
pytest tests/

# Run with coverage
pytest tests/ --cov=sphinx_click_custom --cov-report=term-missing

# Run specific test categories
pytest tests/test_formatting.py -v         # Core formatting (19 tests)
pytest tests/test_edge_cases.py -v         # Edge cases (17 tests)
pytest tests/test_simple.py -v             # Basic functionality (4 tests)
pytest tests/test_directive_simple.py -v   # Directive tests (6 tests)
pytest tests/test_integration_simple.py -v # Integration tests (4 tests)

```

## Test Coverage Highlights

### Core Functionality ✅

- Click object importing and validation
- Help text formatting (basic, multiline, ANSI)
- Usage generation and options formatting
- Custom help interception (the core innovation)

### Edge Cases ✅

- Broken `get_help()` methods
- Commands without `super()` calls
- Empty or malformed help text
- Complex formatting with special characters
- Type validation and error handling

### Integration ✅

- Sphinx extension registration
- Event handling setup
- Cross-version compatibility
- Module import validation
