aboutsummaryrefslogtreecommitdiffstats
path: root/tests/README.md
blob: 024a679b3ad0faf0b9c6647538db5f49d7675fbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# HyperTerm Tests

Test suite for HyperTerm prompt functionality and performance.

## Test Files

### test_prompt.sh
Comprehensive test suite with full functionality testing.

**Features:**
- Individual function testing
- Performance benchmarking
- Git state testing
- Interactive test mode (skipped in CI)
- Non-interactive mode for CI/automation

**Usage:**
```bash
cd tests
bash test_prompt.sh                    # Interactive mode
bash test_prompt.sh --non-interactive  # Non-interactive mode (for CI)
```

### quick_test.sh
Fast validation test for immediate feedback.

**Features:**
- Quick function validation
- Basic performance check
- Works in current directory or creates temp repo

**Usage:**
```bash
cd tests
bash quick_test.sh
```

## Test Environment

Tests create isolated environments to avoid affecting your working directory:
- Temporary git repositories in `/tmp/`
- Various git states (clean, dirty, staged, untracked)
- Automatic cleanup on exit

## Performance Testing

Both test scripts include performance measurements:
- Multiple iterations for accurate timing
- Average execution time per prompt call
- Performance classification (Excellent < 10ms, Good < 50ms)

## Git States Tested

- Clean repository
- Modified files
- Untracked files
- Staged files
- Mixed states
- Ahead/behind tracking

## Requirements

- Git installed and available in PATH
- Bash 4.0 or later
- HyperTerm core files in `../hyperterm/core/`

## Logging

All tests use structured logging:
- `[INFO]` - General information
- `[SUCCESS]` - Successful operations
- `[WARN]` - Warnings
- `[ERROR]` - Errors

## Interactive Mode

The full test suite includes an interactive mode with commands:
- `status` - Show git status
- `prompt` - Show full prompt
- `perf` - Run performance test
- `states` - Test different git states
- `modify` - Create test modifications
- `clean` - Clean working directory
- `exit` - Exit interactive mode