mgechev/revive
Voir sur GitHubReplace existing tests that target unexported functions with tests for exported
Open
#1 362 ouverte le 20 mai 2025
good first issuehelp wantedlow priority
Métriques du dépôt
- Stars
- (5 517 stars)
- Métriques de merge PR
- (Métriques PR en attente)
Description
From https://github.com/mgechev/revive/pull/1353#issuecomment-2887129427:
I'm not sure we should test unexported functions. They are internals and a matter to be freely changed with the refactoring. Testing them makes code less flexible for refactoring and tests more fragile. In my current project, for example, we have this strongly discouraged (with some legacy exceptions).
To improve test structure and enforce better package boundaries, we should refactor our current test suite:
- Replace existing tests that target unexported functions with equivalent tests targeting exported functions. Ensure the functionality is still covered by indirectly testing through public APIs.
- Adopt
_testpackage convention. - Enable testpackage linter in the golangci-lint config.