change: sort stylish issues; test only exported formatter functions - #1587
Conversation
c32457c to
60c4dee
Compare
There was a problem hiding this comment.
Pull request overview
This PR refactors the formatter package tests to follow black-box testing principles by testing the exported Format() method of each formatter rather than unexported helper functions like printStatistics() and table(). The change aligns with Go best practices of testing public APIs and makes tests more resilient to internal implementation changes.
- Removes tests for unexported
printStatisticsandtablefunctions fromformatter/friendly_test.go - Updates
formatter/formatter_test.goto test all formatters through their publicFormat()method with realistic failure data - Adds
github.com/google/go-cmpdependency for better diff output in test failures - Removes the
testpackagelinter exception for the formatter package in.golangci.yml, enabling black-box testing
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| go.mod | Adds google/go-cmp v0.7.0 dependency for improved test assertions |
| go.sum | Updates dependency checksums for google/go-cmp |
| formatter/friendly_test.go | Removes white-box tests of unexported formatter helper functions |
| formatter/formatter_test.go | Refactors to test all formatters via their exported Format() method with more comprehensive test data including multiple failures and severity levels |
| .golangci.yml | Removes testpackage linter exception, enabling black-box testing for formatter package |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 5 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Replace existing tests that target unexported
formatterfunctions with tests for exported.Sort issues by files in
stylishfor consistency. Remove trailing whitespace.Updates #1362