This project includes comprehensive tests for the ccsplit CLI tool.
-
unit_test.go - Pure unit tests that don't require git operations
- Tests for
slugify()function - Tests for
parseWorktrees()function - Tests for data structures and interfaces
- ~40% code coverage
- Tests for
-
main_test.go - Tests for TUI components and helpers
- Tests for list models
- Tests for session items
- Tests for delegate rendering
-
commands_test.go - Integration tests for commands (requires git)
- Tests for
createSessioncommand - Tests for
listSessionscommand - Tests for
cleanupSessioncommand - Currently fails in environments with existing worktrees
- Tests for
-
bash_wrapper_test.sh - Tests for the bash wrapper function
- Tests command passthrough
- Tests session creation output parsing
- All tests passing
go test -v -run "^Test(Slugify|ParseWorktrees|SessionItem|GetCurrentDir|RunCmd|WorktreeType)" ./...go test -v -cover ./...go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html./bash_wrapper_test.shCurrent coverage with passing tests: ~40%
The integration tests that require git operations are currently skipped in CI environments. These tests would provide additional coverage for:
- Session creation workflow
- Worktree management
- Branch operations
- Cleanup operations
The test suite includes benchmarks for performance-critical functions:
go test -bench=. ./...