feat: implement pretty report generator with golden tests - #6
Merged
Merged
Conversation
Add human-friendly report generation:
- Summary statistics (added, removed, modified, moved)
- Detailed change listings with symbols (+, -, ~, ↔)
- Value display with before/after for modifications
- Configurable options (compact, show values, max length)
- Number formatting (whole numbers vs decimals)
- Object/array summarization ({...} N keys, [...] N items)
- Value truncation for long strings
Features:
- Generate(): Full report with customizable options
- GenerateCompact(): Minimal output without values
- GenerateDetailed(): Full output with all values
- DefaultOptions(): Sensible defaults
- formatValue(): Smart value formatting by type
Golden Tests:
- 10 golden test files in testdata/report/
- Tests for all change types and formats
- Value truncation and formatting tests
- Compact vs detailed output tests
- Run with -update flag to regenerate
Integration:
- Wire up in DiffTrees() to populate Result.Report
- Automatic detailed report generation
Testing:
- Comprehensive test suite with 93.8% coverage
- Golden file tests for output validation
- Unit tests for all formatting functions
- Overall project coverage: 84.8%
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implement human-friendly pretty report generator with comprehensive golden tests for output validation.
Features
Report Generation
Smart Value Formatting
Change Symbols
Output Modes
Detailed (default):
Compact:
API
Golden Tests
10 golden test files validate output:
empty.txt- No changessingle_add.txt- Single additionsingle_remove.txt- Single removalsingle_modify.txt- Single modificationmultiple_changes.txt- Mixed changescomplex_values.txt- Objects and arrayscompact_format.txt- Compact modewithout_values.txt- Values hiddenvalue_truncation.txt- Long value handlingnumber_formatting.txt- Number displayRun
go test ./report/... -updateto regenerate golden files.Integration
DiffTrees()Result.Reportfield now populatedTest Coverage
Report Package: 93.8%
Overall Project: 84.8%
Test Categories
Example Output
See golden files in
testdata/report/for exact formatting.Test Plan
🤖 Generated with Claude Code