Commit Graph

3 Commits

Author SHA1 Message Date
58aaad4c9c Add comprehensive edge case tests for status line functions 2025-12-18 11:31:35 +01:00
40452e100e Refactor: Extract testable functions and improve code organization
- Extract TokenUsage as named type (eliminates inline struct repetition)
- Refactor main() into testable functions:
  - readInputFromStdin: Read JSON from stdin
  - parseStatusInput: Validate and parse JSON
  - buildStatusLine: Construct left and right statusline parts
  - calculatePadding: Compute padding for alignment
  - formatOutput: Combine components into final output
- Add comprehensive tests for extracted functions
- Improve coverage from 45% to 71% (+26 percentage points)
- All new functions have 100% test coverage
- Clean linting with zero issues
2025-12-18 11:31:35 +01:00
f1de3c2050 Add unit tests and test tasks
- Add main_test.go with tests for formatContextInfo, stripANSI,
  StatusInput parsing, getGitInfo, and getGiteaStatus
- Add test, test:cover, test:fixture tasks to Taskfile
- 45% code coverage
2025-12-18 06:36:56 +01:00